My project has an orchestration which contains a non-transactional scope.
Inside that scope, there is a call to .NET helper in order to get a Hashtable
with values.
It's important to mention that it is the ONLY thing I perform in that scope, means that scope contains only expression shape which calls the .NET function.
The function which returns the Hashtable
is marked as static
.
It looks like this:
public static Hashtable GetKeys(XmlDocument xmlDoc)
{
Hashtable servicesKey = new Hashtable();
//Key1
int keysCounter = 1;
// Add key1
servicesKey.Add("Key" + keysCounter, Constants.Keys.First);
keysCounter++;
// Add key2
servicesKey.Add("Key" + keysCounter, Constants.Keys.Second);
keysCounter++;
// Add key3
servicesKey.Add("Key" + keysCounter, Constants.Keys.Third);
keysCounter++;
return servicesKey;
}
For some reason, when sending a huge mass of message AND restarting the host instances in the same time - I get as a result an empty Hashtable
on SOME of the messages.
Can someone please assist on how I can change it so messages won't get lost in that situation ?
You need to properly serialize your class in order to guarantee the data will persist correctly.
First you need to give your class the serializable tag:
Then you need to instantiate an instance of it in your orchestration. You do this by creating a variable and assigning it the type of your class (you must reference the assembly containing the class in the biztalk project with the orchestration.)
You can then declare a new instance in an expression shape:
And call your method safely:
Hope this helps.