Send/Receive while in an atomic transaction in BizTalk
I have a Biztalk 2013 Orchestration where I am working on an item that is debatching a message using a call to the pipeline. I am then taking the debatched messages, using them to create SQL WCF Adapter requests to get detail information and then debatch the responses and write it out to they system.
Envelope w/ Orders
<Orders> <Order> <OrderNum>1</OrderNum> </Order> <Order> <OrderNum>2</OrderNum> </Order> <Order> <OrderNum>3</OrderNum> </Order> <Order> <OrderNum>4</OrderNum> </Order> <Order> <OrderNum>5</OrderNum> </Order> <Order> <OrderNum>6</OrderNum> </Order> <Order> <OrderNum>7</OrderNum> </Order> </Orders>
Gets Debatched into individual Order Messages:
<Order> <OrderNum>1</OrderNum> </Order> . . .
This is passed into SQL by creating a stored proc call message with the order number as a parameter.
<OrderDetails> <OrderDetail> <ItemID>1</ItemID> <Price>23.40</Price> </OrderDetail> . . . </OrderDetails>
I then debatch out to individual OrderDetail records using the pipeline in the orchestration.
Anyway, when i call the SQL Server and get a response, I get an error on compile about
"an atomic scope may not contain or call a service or scope that contains both the send and the corresponding receive of a requestresponse operation on a 'uses' port or servicelink".
I change the transaction level of the scope object (needed for the debatching) from atomic to long running, and i get this error.
"a non-serializable object type 'Microsoft.XLANGs.Pipeline.ReceivePipelineOutputMessages GetBatchPipelineOutput' can only be declared within an atomic scope or service"
I need to get the individual items in the list (it can be a long list, hence the reason i used the pipeline) and pass them as arguments to the SQL server, but it seems i can't.
Unfortunately, you stuck in the Atomic penalty box. However, what you want can certainly be done if you can accept a change in what you might be your expected behavior.
You can move the subsequent processing, SQL call and such, logic to a Start'ed Orchestration (not a Called) which will escape your debatching Orchestration's Atomic Scope.
However, be aware that the Start'ed Orchestration(s) will not Actually be activated until the original message has been fully debatched because the Start Messages are not committed to the MessageBox until the Atomic Scope completes.