Interesting problem with Adapter Resubmit() method.

Published on : May 10, 2005

Category : BizTalk Server



Recently we encountered an interesting problem while building an ebMS 2.0 ebxml messaging protocal for reliable messaging.

We decided to make use of the Resubmit() method from ITransportProxy batch in order to say biztalk messaging engine, “Please give us the message back to the transmit adapter after certain time”.

We have to make two changes to the context property,

1. RetryCount: Update this system property (ebMS specific logic).
2. SomeCustomProp: Add few more custom properties to the context.

When we did the batch.Resubmit(msg,DateTime.Now.AddSeconds(60)), everything is fine. After 60 seconds we received the message from Biztalk messaging engine to our adapter successfully.

But we encountered these problems:

1. RetryCount: This value was decremented by 1 from the default value in the port configuration, it ignored the value what we have set before Resubmitting the message.
2. Custom property is lost.

In order to solve this issue, Kartik and Kevin from Microsoft came out with an undocument API call, but it’s really spot on.

This is how you force to update the context manually.

SystemMessageContext sysContext = new SystemMessageContext(messageContext);

UpdateProperty []updates = new UpdateProperty[2];

//Set the retry count
BTS.RetryCount RetryCountProp = new BTS.RetryCount();
updates[0] = new UpdateProperty();
updates[0].Name = RetryCountProp.Name.Name;
updates[0].NameSpace = RetryCountProp.Name.Namespace;
updates[0].Value = 5;

//Add a custom property to tell, we are adding this only during first submit operation, not during resubmit operation
updates[1] = new UpdateProperty();
updates[1].Name = “IsEbXmlMsgTransmitted”;
updates[1].NameSpace = “”;
updates[1].Value = true;

sysContext.UpdateProperties (updates);

DateTime dt = DateTime.Now.AddSeconds(60);

HTH for some one out there.