Pergunta

I am wondering how Service Bus Message Pump works under the hood. Is there any good documentation someone can point me to.

When I send the message to a queue and waiting for the callback call, I don't see any Http Calls happening behind the scene. How is the callback made, are there any open tcp sessions? What protocol is used for this communication .

Any help is Helpful.

Foi útil?

Solução

The Service Bus Message Pump is simply a nice wrapper around the existing Receive operation. My understanding is that under the hood a thread is spun up to request messages off the queue using the standard Receive method. When the message pump receives a message it will spin up a thread and call the OnMessage delegate (up to the number of concurrent calls property on the OnMessageOptions class).

Regarding the actual communication of the message pump to the service bus, that depends on the connectivity mode. By default the connectivity mode for brokered messaging is AutoDetect, but as you see as a comment at the end of the link above brokered messaging doesn't support fall back to HTTP from TCP, so for Brokered messaging it starts at TCP and stays unless you explicitly set it to HTTP.

In HTTP Connectivity mode, if you have the correct ports open, you can see the requests from the Receive call go out and as long polling occurs you can see it renew the requests. In TCP mode (or by default since the AutoDetect doesn't fall back to HTTP) it opens a TCP connection (on port 9354) and uses that for the bidirectional communication. You can see this if use something like Process Explorer or NetStat.

There's actually not that much good documentation on the proprietary protocol used by the Service Bus. They do support AMQP directly, an open messaging protocol, which goes over a different port. The .NET library handles this but you determine the transport via the connectionstring or when creating the MessagingFactory by setting the TransportType on the MessagingFactoryOptions object.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top