Clients -
rabbitmq :
Channel
Public Ballerina API - Ballerina interface to an AMQP Channel
.
To provide AMQ Channel
related functionalities.
Constructor
__init
(ConnectionConfiguration | Connection connectionOrConnectionConfig)
- connectionOrConnectionConfig ConnectionConfiguration | Connection
-
Holds a Ballerina RabbitMQ
Connection
object or the connection parameters.
Remote Methods
Actively declare a non-exclusive, autodelete, non-durable queue, or queue with the given configurations.
Actively declare a non-autodelete, non-durable exchange with no extra arguments, If the arguments are specifed, then the exchange is declared accordingly.
Binds a queue to an exchange with the given binding key.
Publishes a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel.
Deletes the queue with the given name although it is in use or has messages on it. If the paramters ifUnused or ifEmpty is given, the queue is checked before deleting.
Deletes the exchange with the given name.
Purges the contents of the given queue.
Methods
Actively declare a non-exclusive, autodelete, non-durable queue, or queue with the given configurations.
Parameters
- queueConfig QueueConfiguration? - ()
-
Holds the parameters required to declare a queue.
Actively declare a non-autodelete, non-durable exchange with no extra arguments, If the arguments are specifed, then the exchange is declared accordingly.
Parameters
- exchangeConfig ExchangeConfiguration
-
Holds parameters required to declare an exchange.
-
Return Type
(Error?) An error if an I/O error is encountered or nil if successful.
Binds a queue to an exchange with the given binding key.
Parameters
- queueName string
-
Name of the queue.
- exchangeName string
-
Name of the exchange.
- bindingKey string
-
Binding key used to bind the queue to the exchange.
-
Return Type
(Error?) An error if an I/O error is encountered or nil if successful.
basicPublish
(MessageContent messageContent, string routingKey, string exchangeName, BasicProperties? properties)
returns Error?Publishes a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel.
Parameters
- messageContent MessageContent
-
The message body.
- routingKey string
-
The routing key.
- exchangeName string
-
The name of the exchange to which the message is published.
- properties BasicProperties? - ()
-
Other properties for the message - routing headers etc.
-
Return Type
(Error?) An error if an I/O error is encountered or nil if successful.
Deletes the queue with the given name although it is in use or has messages on it. If the paramters ifUnused or ifEmpty is given, the queue is checked before deleting.
Parameters
- queueName string
-
Name of the queue to be deleted.
- ifUnused boolean? - ()
-
True if the queue should be deleted only if not in use.
- ifEmpty boolean? - ()
-
True if the queue should be deleted only if empty.
-
Return Type
(Error?) An error if an I/O error is encountered or nil if successful.
Deletes the exchange with the given name.
Parameters
- exchangeName string
-
The name of the exchange.
-
Return Type
(Error?) An I/O error if an error is encountered or nil otherwise.
Purges the contents of the given queue.
Parameters
- queueName string
-
The name of the queue.
-
Return Type
(Error?) An error if an I/O error is encountered or nil if successful.
Closes the RabbitMQ Channel
.
Parameters
- closeCode int? - ()
-
The close code (For information, go to the "Reply Codes" section in the [AMQP 0-9-1 specification] (#https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf)).
- closeMessage string? - ()
-
A message indicating the reason for closing the channel.
-
Return Type
(Error?) An error if an I/O problem is encountered.
Aborts the RabbitMQ Channel
. Forces the Channel
to close and waits for all the close operations
to complete. Any encountered exceptions in the close operations are silently discarded.
Parameters
- closeCode int? - ()
-
The close code (For information, go to the "Reply Codes" section in the [AMQP 0-9-1 specification] (#https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf)).
- closeMessage string? - ()
-
A message indicating the reason for closing the channel.
-
Return Type
(Error?) An error if an I/O problem is encountered.
Retrieve the Connection which carries this channel.
-
Return Type
(Connection | Error) RabbitMQ Connection object or error if an I/O problem is encountered.