Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Difference between QueueClient.OnMessage and QueieClient.Receive()

$
0
0

Hi,

I was wondering is there was any difference in using Receive and OnMessage() on the queue client class. I know OnMessage takes the delegate to call when a message appears on the queue but is that the only major difference.

Maybe I should be more specific. I am using OnMessage. In my Action expression, I pass the BrokeredMessage reference to a different thread for processing. The Action expression then finishes, ready to receive the next message from the queue. However, when the new thread then tries to access the passed in BrokeredMessage it throws an exception because the BrokeredMessage has been Disposed.

I want to take the BrokeredMessage off the queue (PeekLock), pass it on to another thread for processing, then get the next message, forgetting about the first. The threads that process the message would the call Complete or Abandon on the message.

Thanks for your help

Graham


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>