Tuesday, March 20, 2012

Conversation LIFETIME

I have a conversation that I want to know has not ended so I am using LIFETIME.

When the conversation times out I then have three records in the queue.

1. The original conversation record that has not been received.

2. Error message to the initiator.

3. Error message to the target.

Both message bodies on the error records say that it was a lifetime error.

If I end the conversation on the initiator side after it is sent, I still get the target error record but the message_body field is null.

So say I don't end the conversation on the initator side. My next receive on the target side will pull the original record. Then it will pull the initator record and then it will pull the target record. Nothing on that record says that it had timed out.

What is the best practice for handling lifetime errors?

In the case when you end the conversation from the initiator side you are no seeing an Error message, but an EndDialog message (different message_type_name, no message_body). Because the conversation is ended, it will no longer expire.

To better understand the Service Broker semantics, I recommend you experiment with two separate services on two separate queues. The Broker is a communication mechanism between services, not a primitive for implementing a queue. If you are looking to create a queue, you'll be better of with a user table and proper enqueue/dequeue stored procs.

Can you explain what is application you're trying to build using Broker? We can help you better if we understand what is your goal.

Thanks,
~ Remus

sqlsql

No comments:

Post a Comment