TsgcWSPClient_STOMP_RabbitMQ › Methods › SubscribeExchange
Subscribes directly to an exchange with an optional binding pattern using the /exchange/name[/pattern] prefix.
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);
| Name | Type | Description |
|---|---|---|
aName | const String | Name of the target exchange (must already exist in RabbitMQ). |
aPattern | const String | Optional 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. |
aDurable | const Boolean | If True (default), declares a durable subscription queue that survives a broker restart. |
aAutoDelete | const Boolean | If True, the subscription queue is deleted automatically when the last consumer disconnects. |
aExclusive | const Boolean | If True, the subscription queue is restricted to the current connection and deleted on disconnect. |
aACK | const TsgcSTOMPACK | Acknowledgement mode: ackAuto, ackClient or ackClient-Individual. |
aOptions | const TsgcWSRabbitMQSTOMP_Queue_Options | Optional RabbitMQ x-arguments (MessageTTL, Expires, MaxLength, MaxLengthBytes, DeadLetterExchange, DeadLetterRoutingKey, MaxPriority). When nil the component Queue property is used. |
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.
sgcRabbitMQ.SubscribeExchange('amq.topic', 'stock.*.eur');