TsgcWSPClient_STOMP_RabbitMQMethods › SubscribeTopic

SubscribeTopic Method

Subscribes to a RabbitMQ topic using the /topic/name destination prefix.

Syntax

procedure SubscribeTopic(const aTopic: 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
aTopicconst StringTopic name (without the /topic/ prefix). The component builds the final destination as /topic/aTopic and the broker binds it to the amq.topic exchange using the topic as routing key.
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. When not ackAuto the application must call ACK or NACK for every received message.
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 auto-declares an anonymous queue bound to the amq.topic exchange with the topic name as routing key. Incoming messages are delivered through the OnRabbitMQMessage event.

Example

sgcRabbitMQ.SubscribeTopic('prices');

Back to Methods