P. Kouvarakis
P. Kouvarakis

Reputation: 1943

Logging of received/transmitted messages in Service Broker

Is there a way to log (in a file or database table) the messages sent to and/or received from a Service Broker service without altering the activation procedure or message sending code?

I know I can alter the activation procedure to write the received message to a table before (or after) processing it. And I can change the sending stored procedure to do the same but I am looking for something that:

Note: I need to log the actual message content and associated metadata.

TIA

Upvotes: 1

Views: 1635

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294407

Short answer: No.

You can monitor the Broker:Conversation Event Class via a server trace or as a event notification but will only give you metadata, not the message content.

You can enable queue retention but the retained messages are deleted anyway when the conversation ends and is problematic to turn on/off.

The best option, by far, is to do it from the activated stored procedure itself.

Upvotes: 1

Related Questions