Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Method to order incoming messages by date
- This topic has 2 replies, 1 voice, and was last updated 9 years, 10 months ago by
community-content.
-
AuthorPosts
-
-
June 18, 2008 at 2:30 AM #19941
Hello,
I have the following situation: We’re getting a lot of XML-messages at once. These are written to a database table. Each message has an ID. Messages with the same ID must be inserted in order of a datetime-field, because the SQL procedure writing to the table calculates some fields from formerly inserted records.
So I thought about a solution with “looping plus listen and delay” -scopes to process these messages after the timeout, but the problem is: How do I save the received messages ? And even if I had a batch of them, how do I do an ordered delivery after the timeout ? I guess I won’t get around this without a lot of coding…
Has anyone done this ? Is there a completely different way to achieve such a thing ?
Regards, Michael
-
June 18, 2008 at 3:57 AM #19942
How much control do you have over the database? Is it possible to modify the stored proc? How complicated are the messages and how big are they?
One possibility is to create an insert table and add the incoming messages to this table, as you receive them, after the delay timeout, call a stored proc that will process the insert table adding records to the real tables. You can control the order of processing the messages within this stored proc.
Another possibility is to create a .NET class (it will need to be serializable) that can accumulate these messages and return them in the correct order. As each message arrives have an Add method on this class to save each instance. At delay timeout have a GetNext method that that you can loop on that returns the messages in the correct order.
Another possibility would be to aggregate the messages into a single message, at delay timeout use a custom Xslt map using <xsl:sort> to order the messages and then loop extracting each indivdual message and sending to the DB
Your orchestration will be like an aggregating sequential convoy, you can have a single orchestration by correlating on message type or you could have one orchestration for each ID by correlating on the ID field.
-
June 18, 2008 at 5:00 AM #19944
I can’t do much about the stored procedure. Even if I somehow get my hands on it I’m bound to run into this problem again sooner or later.
My messages are small (1 kb) and not complicated. I’m glad to hear there’s a way to do this in Xslt (sort), although I’m no expert at that. How can I build and scatter the mentioned batch-message in Biztalk ? The rest is already done or easily googled I guess.
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.