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

ReceiveDisabled queue will not allow message sending

$
0
0

I have a requirement to use the Service Bus functionality to place a queue in receive disabled status in a given situation, where messages cannot be removed from the queue, but can still be added.

Having coded a simple test of this, the method seemed to work, however for reasons unknown to me I am now encountering problems when attempting to send messages to a queue in such a status.

The method I have employed to do this for PoC value is first placing the queue in received disabled status using:

    string path = "faultsqueue";
    ManagementClient managementClient = new ManagementClient(connectionString);
    QueueDescription queueDescription = new QueueDescription(path);
    EntityStatus status = EntityStatus.ReceiveDisabled;
    queueDescription.Status = status;
    await managementClient.UpdateQueueAsync(queueDescription);

This successfully places the queue in ReceiveDisabled as I can see through the portal.

Attempting to post messages to the queue with:

     MessageSender messageSender = new MessageSender(connectionString, queueName);
     string messageBody = "This is a test message";
     var message = new Message(Encoding.UTF8.GetBytes(messageBody));
     await messageSender.SendAsync(message);

returns error:

"Messaging entity 'sb://<namespace>.servicebus.windows.net/<queueName>' is currently disabled."

While attempting to pull a message from the queue using:

     MessageReceiver messageReceiver = new MessageReceiver(connectionString, queueName, ReceiveMode.PeekLock);
     Message message = await messageReceiver.ReceiveAsync();
     return new OkObjectResult($"{message.Body.ToString()}");

An error message is returned:

Messaging entity '<namespace>:Queue:<queueName>' is currently disabled for Receive operations.

The second error is as expected, however the message sender seems to see the queue as disabled and is unable to send messages. Any help on this would be much appreciated?

Thanks!

 

Viewing all articles
Browse latest Browse all 1916

Trending Articles



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