Wednesday, March 28, 2012

How do I know where my message come from

I have a service broker service and there are multiple clients that can put messages in the queue of that service. How do I check which message comes from which client? There is no field in the queue like message_senderId or something like that.

If all you need is to send back replies, then is not necesary too know the sender of the message. Simply send back replies on the conversation_handle received and they'll reach the sender.

If you need to know for other reasons, look up sys.conversation_endpoints by the conversation_handle of the received message. It contains the far_fervice and far_broker_instance fields, that are the name of the service that sent the message and the service_broker_guid of the database that hosts that service.

HTH,
~ Remus

sql

No comments:

Post a Comment