Recently we came across an issue in which , while using BizTalk default or custom pipelines, like XML receive pipeline or Pass Thru pipelines, we see a delay of exact 10 seconds, from the time the messages comes into the queue till the time pipeline execution gets completed.
For example:
We send a message to a queue (with journaling enabled), we see the following timestamp on the message:

However in the BizTalk Server Admin console, we see the pipeline execution getting completed at the following time:

We can see a 10 sec delay, from the time message comes to the queue, from the time BizTalk Receive pipeline gets executed. In order to understand the behavior of this delay we did some deep analysis and found out that:
The issue was with the batch size that the MSMQ adapter expects to receive.

Generally BizTalk MSMQ adapter expects the batch size of 20 by default. The adapter is designed in such a way that it will either wait for the batch size of 20 messages or wait for 10 seconds before it timeouts and process the incoming messages, whichever occurs first.
Therefore, we see the 10 sec delay every time when the number of message is less than 10.

Work Around

In order to get past the delay we can reduce the batch size to 1. In that case message will get picked up instantly without the delay.

Hope this helps. !!!

Written By
Rasika Chaudhary

Reviewed By
Jainath V R

Microsoft India GTSC