Cancels a subscription in a queue

The Devprime platform’s ‘RemoveSubscribeRabbitMQ’ method is used to unsubscribe from a queue on an exchange on RabbitMQ. This method removes the existing link between the queue and the exchange, stopping the receipt of messages from the exchange to the queue.

Parameters

  • alias (string, optional): Optional parameter with the name of the Stream Alias as defined in the Stream Adapter configuration. The default value is “Stream1”.

  • queueName (string): Name of the queue whose signature will be removed. This is the unique identifier of the queue in RabbitMQ.

Return

  • bool: Returns true if the signature is successfully removed; otherwise, returns false.

Here’s an example of how to use the RemoveSubscribeRabbitMQ method in your application:

Removing the Signature from a Queue

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Cancelling a queue subscription
var queueName = "myQueueName";
bool success = Dp.Stream.RemoveSubscribeRabbitMQ(queueName);
    if (success)
    {
        Console.WriteLine("Subscription removed successfully.");
    }
    else
    {
        Console.WriteLine("Failed to remove the subscription.");
    }

Considerations

  • Ensure that queueName is correctly configured and exists in RabbitMQ before attempting to remove the signature.
  • After the subscription is canceled, the queue will no longer receive messages from the exchange it was subscribed to.
  • Native implementations of RabbitMQ are specific to this platform and cater to particular use cases. If you migrate to another streaming platform, you’ll need to adjust your code to use Devprime’s standard methods or the new platform’s specific methods.
Last modified September 10, 2024 (6166aa4f)