Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does the service bus QueueClient.Receive work?
    primarykey
    data
    text
    <p>I am using service bus queues to communicate between web role and worker role. I have two queues in my service bus. I am putting a message into the queue from web role and the worker role processes that message and puts another message back into another queue which the web role retrieves and sends to client. Both the web role and worker role threads are continuously running</p> <p>I want to know when the execution control is at QueueClient.Receive, does it wait till it receives the message or if there is no message on the queue then it moves to next line? because in the situation when there is no message on the queue, i had put a breakpoint at QueueClient.Receive to check what happens next but the control doesn't go to next line it just disappears so i thought it might just be waiting. </p> <p>But in my web role below i am sending a message to worker role through service bus queue and am expecting a response again from worker role immediately but sometimes worker role takes a bit of processing time and the web role doesn't get it and the web role thread goes to sleep.</p> <p>I am a beginner in windows azure, so am a bit confused about this whole problem. Can anyone please help me out?</p> <p>My worker Role:</p> <pre><code>// Receive the message from Web Role BrokeredMessage receivedBroadcastMessage = null; receivedBroadcastMessage = WebRoleClient.Receive(); if (receivedBroadcastMessage != null) { // Process the message receivedBroadcastMessage.Complete(); } BrokeredMessage webRoleMessage = new BrokeredMessage(processedMessage); WorkerRoleClient.Send(webRoleMessage); </code></pre> <p>My Web Role:</p> <pre><code>// send the request to worker role BrokeredMessage webRoleMessage = new BrokeredMessage(details); WebRoleClient.Send(webRoleMessage); // receive the queue from worker role BrokeredMessage workerRoleMessage = null; workerRoleMessage = WorkerRoleClient.Receive(); if (workerRoleMessage != null) { //process message workerRoleMessage.Complete(); } else { // sleep thread } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload