BizTalk and Store-and-Forward
Last month I was raving about BizTalks Message Boxes. Last week I got somewhat disappointed: BizTalk does not support the basic store-end-forward message exchange pattern.
What am I trying to do?
I am trying to publish a message (store-and-forward message) to Message Box and have another orchestration - which may not be active at the time of message origination - be started by ANOTHER MESSAGE (kick-off message) and pick the message in question (store-and-forward message) later on.
Why do I fail
I faile because BizTalk does not support store-and-forward. BizTalk’s messaging is somewhat unusual in that it is ‘push and awake receiver’.
In traditional messaging systems (thing MQ Series), producer pushes a message into a queue and a queue retains a message until consumer pulls it from a queue.
In BizTalk, when a producer pushes a message into a Message Box, BizTalk’s Messaging Agent identifies all orchestrations that subscribe to that message. If there is no orchestration(s) that subscribe(s) to that message, the producer fails with ‘routing failure’ exception.
Two subscription scenarios are possible:
- Activating subscription. An orchestration has an activating receive shape for a given message type. If a message of this type is published to Message Box, the Messaging Agent creates a new orchestration instance.
- Non-activating subscription. An orchestration has a non-activating receive shape. For non-activating receive, BizTalk requires that — in addition to the message type (schema) — the orchestration specify a correlation set so that BizTalk can match a message to exactly one target orchestration instance. See discussion about (Convoys) for more.
In order to implement store and forward, we’d need BizTalk tp support non-activating subscriptionx where the correlation set is not required. But this is not supported.
What to do?
There is no good workaround. You could play with Convoys and create a ’singleton’ orchestration that permanently subscribes to both kick-off message and store-and-forward message. I think that you are unlikely to succeed. Even if you did, the resulting solution is at best fragile and - well .. - ugly.
If you really need store and forward, you need more than Message Boxes: ideall a proper queue (MSMQ, MQ) or - if you dont want to spend the money on licenses or putting up with the bloated messaging infrastructure - use a database as a store for the store-and-forward messaging.