Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSMQ querying for a specific message

Tags:

msmq

I have a questing regarding MSMQ... I designed an async arhitecture like this:

CLient - > WCF Service (hosted in WinService) -> MSMQ

so basically the WCF service takes the requests, processes them, adds them to an INPUT queue and returns a GUID. The same WCF service (through a listener) takes first message from queue (does some stuff...) and then it puts it back into another queue (OUTPUT).

The problem is how can I retrieve the result from the OUTPUT queue when a client requests it... because MSMQ does not allow random access to it's messages and the only solution would be to iterate through all messages and push them back in until I find the exact one I need. I do not want to use DB for this OUTPUT queue, because of some limitations imposed by the client...

like image 407
GeoXYZ Avatar asked Dec 08 '22 05:12

GeoXYZ


1 Answers

You can look in your Output-Queue for your message by using

var mq = new MessageQueue(outputQueueName);
mq.PeekById(yourId);

Receiving by Id:

mq.ReceiveById(yourId);
like image 167
Louis Haußknecht Avatar answered May 10 '23 17:05

Louis Haußknecht