Orchestration

What is BizTalk Orchestration?
  • Orchestration is as way to automate business process management(BPM).
  • It is just an executable code to run a workflow supporting a business process.
  • Orchestration interacts with outside entities by using the ports (receive and send port).
At run time, the BizTalk Orchestration Engine executes XLANG/s files that are produced by BizTalk Orchestration Designer. Orchestration Designer is a rich graphical tool for visually designing business processes. It generates XLANG/s files that have an .odx extension and contain additional visualization information in their headers and custom attribute information in their bodies.

Note:XLANG/s can be viewed as a messaging language with some of the expression capabilities of C#.

The primary functions of the orchestration engine are:
  • Persistence
  • Hosting the .NET components
  • Transactions
  • Large message support
  • Runtime validation
  • Load throttling

Can an orchestration Start without an Activatable receive?
Only if it is called from another orchestration.


When you use Call Orchestration shape vs Start Orchestration shape?
A Call Orchestration returns the control back to the caller. A Start Ochestration shape starts the orchestration in a non-deterministic way.


Can we get messages to Orchestration without using schema?
If you use XML object, then you can get any *.xml messages into orchestration.


How to transfer files without using Orchestration?
Content Based Routing


What are Host and Host Instance? Did you deploy BizTalk more than one machine?
Host is nothing but the logical container of host instance. from which we can create host instance. Host instance is a Win-NT service.
A BizTalk Server Host is a logical set of zero or more BizTalk Server run-time processes in which you deploy items such as adapter handlers, receive locations (including pipelines), and orchestrations.
 A host instance is the process where the message processing, receiving, and transmitting occurs You install a host instance on each server running BizTalk Server that has one or more hosts mapped to that server.


What is Message routing and Content routing?
When A message is passed through biztalk without being processed then it is called Message Routing. When A message is passed based on certain field value of schema, it is called content routing.


What is BizTalk Orchestrations Dehydration and Rehydration?
Dehydration:
When an orchestration has been idle for a while, the orchestration engine will save the state information of the instance and free up memory resources.

Rehydration:
When a message is received, or else when a timeout has expired, the orchestration engine can be automatically triggered to rehydrate the instance – it is at this point that the orchestration engine loads the saved instance of the orchestration into memory, restores the state, and runs its from the point it left off.


Is it possible to share variables across two branches in a Parallel shape?
yes it is possible you just need to set the “Synchronized” property to true.


When do we need set the property “Synchronized” = true for a scope?
In case we want to share a variable between parallel scopes.

What is Correlation in context of BizTalk Server?
An Orchestration can have more than one instance running simultaneously. Even though each of those multiple instances performs the same action, it does it on different data contained within a message.

Correlation is a process of associating an incoming message with the appropriate instance of an orchestration.

For Example: If your orchestration issues a purchase order, receives an invoice, and sends a payment, the developer must make certain that the invoice message is received by the orchestration instance which corresponds to the orchestration that sent the Purchase Order. Without correlation, it would be possible to send out an invoice for thousands of items even though the purchase order is for one. And each correlation is based on a set of properties known as correlation types.


What is the difference between Distinguished field and Promoted Property?
Promoted properties can be accessed in Orchestrations, ports, pipelines, schemas. They Use server resources.

Distinguished fields are light weight and can be accessed only in Orchestrations. 


What is the difference between a "Message Assignment" shape and an "Expression" shape?
 A "Message Assignment" shape is used to create a new message and assign values to it.

An Expression shape is used to assign values to variables and also write 'if' conditions.


What is a Message Type (i.e. BTS.MessageType) and how is it used in BizTalk?
Message Type is a BizTalk System property that is promoted inside a Pipeline.  It is made up of Document Name Space # Root Node Name.


How do you call a Non-Serializable .Net helper class inside an Expression Shape?
  • Add a reference to that class.
  • Make sure your Orchestration is Long Running transactional.
  • Add an Atomic scope.
  • Create an Orchestration variable of that class inside the scope.
  • Create an instance on that object inside the scope.
  • Call the method.
Bonus: Mention the class must be strongly signed and in the GAC.


What if the class is not Serializable?
No transactional Orchestration or Atomic scope is needed.


Step-by-step, how do you set up a basic, pure messaging solution taking in a flat file and send an Xml File out to 5 different places?
Create a Flat File schema
Create a Custom Pipeline using the Flat File Disassembler
Create a Receive Port
Create 5 Send Ports
Create a Send Port Group
Add each Send Port to the Send Port Group
Create a Filer on the Send Port Group using Bts.ReceivePortName (or something close to this)
Additional: no map is required but it is ok to mention it


What is the difference between a Distinguished field and a Promoted Property?
Distinguished fields are light weight and can only be used inside an Orchestration.

Promoted Properties are defined inside a property schema, are tracking in SQL, can be tracked in HAT, and can be used for content based routing.


How do you achieve First-In-First-Out message processing of messages received from multiple sources using an Orchestration?
Use a Sequential Convoy to process the messages in the order they are received into the Message Box.

Make sure Ordered Delivery is set to True inside the Orchestration Receive Port.



At high level, what do Receive Ports and Orchestration Send Port really do in terms of messaging? What about Send Ports and Orchestration Receive Ports?
Receive Ports and Orchestration Send Port are both publishers.
Ports and Orchestration Receive Ports are both subscribers.


When working with Schemas, Maps, Pipelines, and Orchestrations how the projects should be structured?
Schemas and Maps in its own project
Or Schemas and Maps together in its own project
Orchestrations in its own project
Pipelines in it own project


What is direct binding?
Direct binding has three types: direct to message box, self correlating, and partner ports.

Used to route message between the message box and Orchestrations without using bindings or from one Orchestration to another Orchestration.


What are Persistence Points and what causes them?
Persistence is when the state of a running Orchestration is stored into SQL.

It is good enough to know various shape and actions cause persistence.  More specifically, it occurs: end of a transactional scope, at a send shape, at a start Orchestration shape, during dehydration, if the system shuts down expectedly or unexpectedly, or the business process suspends or ends.


What is the difference between a delay shape vs a listen shape?
A 'Delay' is very much similar to a sleep on the current thread. A 'Listen' shape is used to wait for an incoming resource, with a timeout period.


When you use Call Orchestration shape vs Start Orchestration shape?
A Call Orchestration returns the control back to the caller. A Start Ochestration shape starts the orchestration in a non-deterministic way.


What is the difference between a "Message Assignment" shape and an "Expression" shape?
A "Message Assignment" shape is used to create a new message and assign values to it. A Expression shape is used to assign values to variables and also write 'if' conditions.


Does BizTalk Orchestrations support recursion?
An Orchestration does NOT support recursion.


What is the purpose of the property "Activate" in a Receive shape?
It is used to invoke a new instance of an Orchestration.


Can an orchestration Start without an Activatable receive?
A Nested Orchestration can be started without an Activatable receive


Is it necessary for all .NET components being called from an Orchestration be Serializable?
Yes it is necessary. There are cases where a .NET component need not be Serializable.


When do we need set the property "Synchronized" = true for a scope?
This needs to be set, when a variable is shared across the branches of a parallel shape.


What is the difference between an Exception block and a Compensation block? is it the equivalent of try-catch-finally?
Exception block can be termed as a catch block. But compensation is different. Its like reversal of a committed transaction.


How does one enable Correlations in BizTalk?
First create a Correlation type and then create an instance of it.


In an Orchestration design, Orchestration "A" calls another Orchestration "B", and vice versa. Is it possible to implement this design?
It is NOT possible, since it forms a cyclic dependency.

List out the three important things to consider while designing a BizTalk orchestration!
The Incoming data format, The Business process and The Outgoing data format.


How can I share global variables across all instances of a given orchestration?
There is no easy way to share global variables across all instances of an orchestration. If the global variables are static values, you might consider storing them in a persistent storage, such as a configuration file or SQL database, and allowing each instance to get the values from storage. You can also share a static state in user code as long as locks are placed correctly on access and modification of the shared state.


Why is my orchestration instance suspended with the status of "Completed with Discarded Messages"?
"Completed with Discarded Messages" is one of the states an orchestration instance may end with. A message that is discarded in this way is called a "zombie" and typically occurs when an extra message is routed after control flow in the executing orchestration has passed the Receive shape with the matching subscription. This can be due to a time-out on a long-running transaction or a time-out of a Delay branch on a Listen shape. It can also occur in a loop that contains a Receive shape that exits before consuming all routed messages.

You can use a Windows Management Instrumentation (WMI) method to listen to the suspend events, find the message associated with the orchestration instance, and resubmit the message.


Many messages end up with the status of "Delivered Not Consumed" in HAT. Should I be concerned with them and where should I look?
A message is in the "Delivered Not Consumed" state when it is in the BizTalk Server internal work queue. It might be in this state because the engine is busy with other messages, or because the message destination is processing more slowly than expected.

You first need to determine where these messages are going: to the orchestration or to the send port. In HAT, you can figure this out by looking at what service the "delivered not consumed" references are associated with. Then you can check whether the destination orchestration or the send port is working correctly.


Why does the compiler require my variable to be serializable?
The XLANGs runtime may persist to the database (dehydrate) your orchestration, including all of its data, at any point (except in the atomic scope). When the orchestration dehydrates and rehydrates, user-defined variables are binary serialized and deserialized. In most cases, you need a serializable object. A non-serializable object can only be declared and used in an atomic scope. The XLANGs compiler gives you compilation errors if you try to use a non-serializable data type outside of an atomic scope.
Message definitions, whether with .NET types or with actual message types, require that the .NET types be XML serializable (for example, System.IntPtrcannot define a message), and that all the message parts (in the message type) be defined through either XML-serializable .NET types or schema types.


My object is serializable and implements an interface. When I try to access my object in an Expression shape of a non-atomic scope, the compiler complains that my object is non-serializable. Why?
Interfaces cannot be marked serializable, nor can you assume that they are serializable, because you never know how they are implemented. Therefore, XLANGs treats interfaces as non-serializable. Non-serializable objects must run inside atomic scopes. This is why interface-based programming must be done inside an atomic scope. In fact, in .NET, you cannot declare an interface to be serializable.


How does an orchestration invoke a COM/COM+ component?
XLANGs generates C# code. All user-declared XLANGs variables are generated as C# variables. There is no special behavior except in the case of atomic transactions. When a serviced component (that is, an instance of a class that implements System.EnterpriseServices.ServicedComponent) is declared in an atomic scope, then and only then does XLANGs generate and use a real DTC COM+ transaction.
If a variable is referenced as an L-value (that is, it is written to) in the atomic scope, but is declared in an outer scope, the variable is cloned to support rollback. However, an object (such as an XmlDocument) can be modified inside a .NET function call when passed as an in-parameter, and thus XLANGs will miss that the object is being written to and it will not roll back correctly. The workaround in this case is to pass such objects as ref parameters.
The bottom line is that components should behave as they do in other C# programs.


Why doesn't my atomic transaction retry? How does the atomic transaction retry work?
An atomic transaction retries when a RetryTransactionException is deliberately thrown by the user or when a PersistenceException is raised at the time that the atomic transaction tries to commit. The latter could happen if, for example, your atomic transaction was part of a distributed DTC transaction and some other participant in that transaction aborted the transaction. Likewise if there were database connectivity problems at the time when the transaction was trying to commit, a PersistenceException would be raised.

There can be several root causes for PersistenceException, depending on the situation, but what you generally observe is that all the XLANGs actions in your atomic scope seem to go through correctly, but then instead of committing, the scope fails. If that happens for an atomic scope that has Retry=True, then the atomic scope will retry up to 21 times. The delay between each retry is two seconds by default (but you can modify that value). After 21 retries, if the transaction is still unable to commit, the whole orchestration instance gets suspended. Then you can manually resume it and it will start over, with a fresh counter, from the beginning of the offending atomic scope.
Note that only two exception types can cause an atomic scope to retry: RetryTransactionException and PersistenceException. Any other exception raised in your atomic scope cannot cause it to retry, even if you have the Retry property set to True. If you're having trouble trying to figure out why an atomic scope isn't retrying, double-check the exception type.

You can override the two-second default delay between consecutive retries by using a public property on RetryTransactionException (if that's the exception you're using to cause the retries).


Does orchestration support parallel activation?
Parallel-activating Receive shapes do work under the following conditions:
  1. If one of the tasks of a parallel activation has an activatable Receive as the first shape, all of the tasks of that parallel activation must have an activatable Receive as the first shape, and all of those Receive shapes must initialize at least one correlation.
  2. If a particular correlation is initialized on more than one task of a parallel activation by a Receive shape, each of the concerned activating Receive shapes must initialize exactly the same correlation.
This is the parallel convoy case. It is the only parallel activation that XLANGs supports.


Why do I sometimes get "could not find subscription error" when I send a message from the parent orchestration to the child orchestration, which was just started by the parent?
This is a race condition. Apparently you expect that the new orchestration will start in time to create the necessary subscriptions to receive the messages that will be sent to it. But you have no idea how long it will take to create the orchestration, because starting a new service is not a synchronous operation.
It would be better to have the newly created orchestration send a message back to its parent orchestration, reporting that it has started. Then have the new orchestration listen for its messages. In this scenario, the parent orchestration knows that there is a receiver for the messages before sending them. This also provides the necessary commit point to get the subscription to the MessageBox database.


How can I get context or other promoted properties from XLANGMessage?
In an Expression shape, you can use your Message(propertyName), for example, yourMessage(BTS.MessageID). However, if you want to access message properties from the XLANGMessage interface (for example, from user code), you would use the XLANGMessage methods SetPropertyValue andGetPropertyValue. You cannot use a context property for routing unless the property is in a correlation that is either initialized or followed in a Sendshape.


I attach a dynamic send port to a logical port with Delivery Notification = Transmitted. However, the runtime does not seem to deliver any delivery notification. What is going on?
Dynamic ports are not designed to inherit all attributes and characteristics of the port whose address is assigned to the dynamic port. A dynamic port just gets an address, which is analogous to casting a void* pointer in C/C++ to a more structured pointer type. The pointer that initialized that address has had all its information stripped away. The XLANGs runtime only listens for delivery notification if the port is statically set up that way.


How can I perform dynamic transform in XLANGs?
You can use construct/transform code inside an Expression shape, to make it possible to assign the map dynamically. The code inside the Expressionshape is similar to the following:
mapType = System.Type.GetType(mapName);
construct Out_msg{  transform(Out_msg) = mapType(In_msg, In2_msg);}


I changed some message fields inside an Expression shape. However, when I send the message out, I do not see the updated values. Why?
In BizTalk Server, the messages are immutable. You can use a Construct shape to create a new message. Copy the original message to the new message and update the fields on the new message.

The orchestration calls a Web service with the SOAP send adapter and receives the response. When an exception occurs, the orchestration service is suspended with "Suspended (not resumable)". How can I retry the Send?
You can place the SOAP Send inside a scope with an exception handler and let the exception handler catch the resulting SoapException. Then you can retry the SOAP Send by nesting the scope inside a while loop.


How can I load a message to construct an XLANGMessage?
When constructing an XLANGMessage with a stream, the stream type must either implement IStreamFactory or else be a MemoryStream. The following code sample shows how to construct an XLANGMessage:

public class FileStreamFactory : IStreamFactory
{
    string _fname;

    public FileStreamFactory(string fname)
    {
        _fname = fname;
    }

    public Stream CreateStream()
    {
        return new FileStream
        (
            _fname,
            FileMode.Open,
            FileAccess.Read,
            FileShare.Read
        );
    }
}

public static void AssignStreamFactoryToPart(XLANGMessage msg)
{
    IStreamFactory sf = new FileStreamFactory( @”c:\data.xml” );
    msg[0].LoadFrom( sf );
}


How can I clean up suspended send port instances after handling the XLANGs exception?
Whenever a message is suspended after retries to a send port, the messaging engine generates a NACK. This NACK is translated into an exception in the orchestration. You can set the DeliveryNotification property to Transmitted on your send port, and add a catch handler to your scope to handle aDeliveryFailureException. However, in addition to generating the NACK, the messaging engine also suspends the message. There is no way to disable this behavior.
You need your own logic to clean up the suspended send port instance (message). You can create another orchestration that subscribes to NACKs. Both ACKs and NACKs have the following system context properties promoted, which can be used in filter expressions for routing.
After you have written an error-handling orchestration to subscribe to NACKs, you can use BizTalk Server WMI methods to terminate the suspended instance. You will get the instanceID of the suspended send port instance in the NACK.
Some of the context properties you can use in subscribing are:
• BTS.AckType. Set to ACK or NACK.
• AckID. Set to the message ID of the message that this ACK/NACK is for.
• AckOwnerID. Set to the instance ID that this ACK/NACK is for.
• AckSendPortName. The name of the send port that this message was being sent over.
• AckOutboundTransportLocation. The outbound URL that this message was being sent to.


I have an orchestration with custom components. I deployed my assembly successfully. However, when I tried to run the application, I got an error: "File or Assembly name or one of its dependences not found."
This error usually means the BizTalk orchestration engine cannot locate the custom component. You must install all assemblies included in a BizTalk application in the global assembly cache of the computer that hosts the application.


How do you call a Non-Serializable .Net helper class inside an Expression Shape?
Add a reference of that dll (class). The class must be strongly signed and in the GAC. Make sure your transaction type of Orchestration is Long Running transactional.
  • Add an Atomic scope.
  • Create an Orchestration variable of that class inside the scope.
  • Create an instance on that object inside the scope.
  • Call the method

What is Dehydration?
When an orchestration has been idle for a while, the orchestration engine will save the state information of the instance and free up memory resources.

Rehydration?
When a message is received, or else when a timeout has expired, the orchestration engine can be automatically triggered to rehydrate the instance – it is at this point that the orchestration engine loads the saved instance of the orchestration into memory, restores the state, and runs its from the point it left off.


What is atomic Transaction?
It follows full ACID properties Atomicity, Consistency, Isolation and Durability.
If you require full ACID properties on the data—for example, when the data must be isolated from other transactions—you must use atomic transactions exclusively. When an atomic transaction fails, all states are reset as if the orchestration instance never entered the scope.


What is long running transaction?
Long running transaction support CD properties of ACID. It is not practical to lock transaction for a long time. This transaction can run indefinitely and can be dehydrated also.

What is the difference between static, dynamic and direct binding? 
  • static binding specifies particular port address
  • dynamic gives address of the port at runtime
  • direct binding sends messages to MessageBox


Can a flat file message be processing without a pipeline?
Nopes, job of a pipeline is to convert an incoming message in to an XML the format which biztalk understands.


How do you achieve First-In-First-Out message processing of messages received from multiple sources using an Orchestration?
you need to build a resequencer pattern. As with ordered delivery there are some limitations such as it expects the all the message to be in order. Secondly your throughput decreases drastically.


What is Correlation?
Correlation in orchestrations is the mechanism for receiving related messages into the same running orchestration instance. In the Orchestration Designer a developer follows these general steps to use a correlation:
  • Defines a correlation type that includes the promoted properties that are used to relate messages.
  • Defines a correlation set that is an instance of the correlation type just defined.
  • For the send and receive ports, specifies whether they initiate or follow a given correlation set.
Instance subscriptions come into play when a correlation set is initiated, as this is when subscriptions are created for all of those ports that follow this correlation set to receive messages. Because the correlation type defines the properties to be used for correlation, the orchestration engine can extract these properties from the message being sent or received by the initiating action. These values are then used to define subscriptions for all of the remaining actions which follow this correlation set.


What are Persistence Points and what causes them?
Persistence is when the state of a running Orchestration is stored into SQL.

It is good enough to know various shape and actions cause persistence.  More specifically, it occurs: end of a transactional scope, at a send shape, at a start Orchestration shape, during dehydration, if the system shuts down expectedly or unexpectedly, or the business process suspends or ends.


How to debug an Orchestration?
You can apply break points in HAT (Health Activity Monitoring).


In the Orchestration what is the difference between Exception and Compensation? Give an example of its usage scenario. 
Exception is simple the try catch block in .net. Lets say you have an expression a = b/c where c=0 it will raise an exception and will be caught in catch block.

Compensation is like you made a transaction where u debited customers account. Now you will do exact opposite meaning crediting with the same amount and the same account.



No comments:

Post a Comment