开发者

NService bus message not coming in sequence (i.e as it is sent)

We are using NService bus for our messaging framework.Sometime the message is not coming as par the sequence of sending .Sometimes last message is coming开发者_运维问答 first and than later first message.

Please help me out Thanks


The nature of NServiceBus does not guarantee that messages will be received in the order they were sent. Each message is meant to be processed independently.

If an action can only be undertaken after two related messages arrive, then you need to utilize a Saga

Edit in response to first comment:

You mention you're sending the same message in chunks. Does this mean that you have a large payload that you have to split up into multiple parts to transmit via MSMQ?

If so, you have a few options:

  1. Store the payload out of band, in a database or file system, and only put enough data in one message (an ID or file system path) to load the data from the message handler.

  2. Make the message a MessagePart that contains a BundleID, PartNumber, TotalParts, and PayloadChunk. Then, create a saga for MessagePart that stores each part and when all parts have been received, reconstitute the chunks together and do what you need. Of course, if you need to then send the resulting large object back onto the Bus, this would get annoying really quickly, so then the out-of-band option would look much more attractive.

In any case, there are a ton of reasons why any MSMQ message, not just NServiceBus messages, could arrive out of order, so you have to be able to deal with it.


Would Bus.Sending a collection of Imessages work? NServiceBus allows batching of messages

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜