TsgcWSPClient_STOMP_RabbitMQMethods › SubscribeExchange

SubscribeExchange Method

Subscribes directly to an exchange with an optional binding pattern using the /exchange/name[/pattern] prefix.

Syntax

procedure SubscribeExchange(const aName, aPattern: String; const aDurable: Boolean = True; const aAutoDelete: Boolean = False; const aExclusive: Boolean = False; const aACK: TsgcSTOMPACK = ackAuto; const aOptions: TsgcWSRabbitMQSTOMP_Queue_Options = nil);

Parameters

NameTypeDescription
aNameconst StringName of the target exchange (must already exist in RabbitMQ).
aPatternconst StringOptional binding pattern: a routing key for direct exchanges, a wildcard expression such as stock.*.eur for topic exchanges, or empty for fanout. Leave empty to bind to the exchange default.
aDurableconst BooleanIf True (default), declares a durable subscription queue that survives a broker restart.
aAutoDeleteconst BooleanIf True, the subscription queue is deleted automatically when the last consumer disconnects.
aExclusiveconst BooleanIf True, the subscription queue is restricted to the current connection and deleted on disconnect.
aACKconst TsgcSTOMPACKAcknowledgement mode: ackAuto, ackClient or ackClient-Individual.
aOptionsconst TsgcWSRabbitMQSTOMP_Queue_OptionsOptional RabbitMQ x-arguments (MessageTTL, Expires, MaxLength, MaxLengthBytes, DeadLetterExchange, DeadLetterRoutingKey, MaxPriority). When nil the component Queue property is used.

Remarks

The RabbitMQ STOMP plugin creates an anonymous queue and binds it to aName using aPattern as binding key. This form gives full control over the exchange type and routing semantics, which the topic / queue helpers hide.

Example

sgcRabbitMQ.SubscribeExchange('amq.topic', 'stock.*.eur');

Back to Methods