Would anyone know why System.Messaging is not offering an asynchronous version of the Send method to send an MSMQ message to a queue.
Actually there is asynchronous version of Peek and Receive methods (via Begin/End pairs that can be converted to a C#5 async awaitable method), but surprinsingly there is no BeginSend/EndSend methods offered, just a Send method which seems to me like it's a synchronous blocking I/O call.
I think this is not a limitation of System.Messaging but rather one of the native messaging queue API (mqrt.dll) that System.Messaging is using which takes an overlapped structure as a parameter in function MQReceiveMessage
to use overlapping I/O with IOCP, whereas function MQsendMessage
does not take such structure so seems like it's a purely synchronous call.
Still my question remains, anyone would know why MessageQueue API does not offer an asynchronous way of sending a message to a queue ?