AMQPChannel

interface AMQPChannel

Inheritors

Properties

Link copied to clipboard

A deferred that completes when the channek is closed.

Link copied to clipboard

A flow of closed responses from the channel.

Link copied to clipboard

A flow of basic delivery messages.

Link copied to clipboard
abstract val id: ChannelId

Unique identifier of the channel.

Link copied to clipboard
abstract val isConfirmMode: Boolean

True when the channel is in confirm mode.

Link copied to clipboard
abstract val isTxMode: Boolean

True when the channel is in transaction mode.

Link copied to clipboard

A flow of opened responses from the channel.

Link copied to clipboard

A flow of basic publish confirm responses.

Link copied to clipboard

A flow of basic return responses.

Link copied to clipboard
abstract val state: ConnectionState

The channel connection state.

Functions

Link copied to clipboard
abstract suspend fun basicAck(message: AMQPMessage, multiple: Boolean = false)
abstract suspend fun basicAck(deliveryTag: ULong, multiple: Boolean = false)

Acknowledge a message.

Link copied to clipboard
abstract suspend fun basicCancel(consumerTag: String): AMQPResponse.Channel.Basic.Canceled

Cancel sending messages from server to consumer.

Link copied to clipboard
abstract suspend fun basicConsume(queue: String, consumerTag: String = "", noAck: Boolean = false, exclusive: Boolean = false, arguments: Table = emptyMap()): AMQPReceiveChannel

Consume messages from a queue by sending them to the channel. The consumer is automatically canceled when the channel is closed.

abstract suspend fun basicConsume(queue: String, consumerTag: String = "", noAck: Boolean = false, exclusive: Boolean = false, arguments: Table = emptyMap(), onDelivery: suspend (AMQPResponse.Channel.Message.Delivery) -> Unit, onCanceled: suspend (AMQPResponse.Channel) -> Unit = {}): AMQPResponse.Channel.Basic.ConsumeOk

Consume messages from a queue by sending them to registered consume listeners. The caller is responsible for cancelling the consumer when done.

Link copied to clipboard
abstract suspend fun basicGet(queue: String, noAck: Boolean = false): AMQPResponse.Channel.Message.Get

Get a single message from a queue.

Link copied to clipboard
abstract suspend fun basicNack(message: AMQPMessage, multiple: Boolean = false, requeue: Boolean = false)
abstract suspend fun basicNack(deliveryTag: ULong, multiple: Boolean = false, requeue: Boolean = false)

Reject a message.

Link copied to clipboard
abstract suspend fun basicPublish(body: ByteArray, exchange: String, routingKey: String, mandatory: Boolean = false, immediate: Boolean = false, properties: Properties = Properties()): AMQPResponse.Channel.Basic.Published

Publish a ByteArray message to exchange or queue.

Link copied to clipboard
abstract suspend fun basicQos(count: UShort, global: Boolean = false): AMQPResponse.Channel.Basic.QosOk

Sets a prefetch limit when consuming messages. No more messages will be delivered to the consumer until one or more messages have been acknowledged or rejected.

Link copied to clipboard
abstract suspend fun basicRecover(requeue: Boolean = false): AMQPResponse.Channel.Basic.Recovered

Tell the broker what to do with all unacknowledged messages. Unacknowledged messages retrieved by basicGet are requeued regardless.

Link copied to clipboard
abstract suspend fun basicReject(message: AMQPMessage, requeue: Boolean = false)
abstract suspend fun basicReject(deliveryTag: ULong, requeue: Boolean = false)

Reject a message.

Link copied to clipboard
abstract suspend fun close(reason: String = "", code: UShort): AMQPResponse.Channel.Closed

Closes the channel.

Link copied to clipboard

Set channel in publish confirm mode, each published message will be acked or nacked.

Link copied to clipboard
abstract suspend fun consumerCount(name: String): UInt

Returns the number of consumers subscribed to a queue.

Link copied to clipboard
abstract suspend fun exchangeBind(destination: String, source: String, routingKey: String, arguments: Table = emptyMap()): AMQPResponse.Channel.Exchange.Bound

Bind an exchange to another exchange.

Link copied to clipboard
abstract suspend fun exchangeDeclare(name: String, type: String, durable: Boolean = false, autoDelete: Boolean = false, internal: Boolean = false, arguments: Table = emptyMap()): AMQPResponse.Channel.Exchange.Declared

Declare an exchange.

Link copied to clipboard

Passively declare an exchange.

Link copied to clipboard
abstract suspend fun exchangeDelete(name: String, ifUnused: Boolean = false): AMQPResponse.Channel.Exchange.Deleted

Delete an exchange.

Link copied to clipboard
abstract suspend fun exchangeUnbind(destination: String, source: String, routingKey: String, arguments: Table = emptyMap()): AMQPResponse.Channel.Exchange.Unbound

Unbind an exchange from another exchange.

Link copied to clipboard
abstract suspend fun flow(active: Boolean): AMQPResponse.Channel.Flowed

Send a flow message to broker to start or stop sending messages to consumers. Warning: Not supported by all brokers.

Link copied to clipboard
abstract suspend fun messageCount(name: String): UInt

Returns the number of messages in a queue.

Link copied to clipboard
abstract suspend fun open(): AMQPResponse.Channel.Opened

Opens the channel.

Link copied to clipboard
abstract suspend fun queueBind(queue: String, exchange: String, routingKey: String = "", arguments: Table = emptyMap()): AMQPResponse.Channel.Queue.Bound

Binds a queue to an exchange.

Link copied to clipboard

Declare a server-named exclusive, autodelete, non-durable queue.

abstract suspend fun queueDeclare(name: String, durable: Boolean = false, exclusive: Boolean = false, autoDelete: Boolean = false, arguments: Table = emptyMap()): AMQPResponse.Channel.Queue.Declared

Declares a queue.

Link copied to clipboard

Passively declares a queue.

Link copied to clipboard
abstract suspend fun queueDelete(name: String, ifUnused: Boolean = false, ifEmpty: Boolean = false): AMQPResponse.Channel.Queue.Deleted

Deletes a queue.

Link copied to clipboard

Deletes all messages from a queue.

Link copied to clipboard
abstract suspend fun queueUnbind(queue: String, exchange: String, routingKey: String = "", arguments: Table = emptyMap()): AMQPResponse.Channel.Queue.Unbound

Unbinds a queue from an exchange.

Link copied to clipboard

Commit a transaction.

Link copied to clipboard

Rollback a transaction.

Link copied to clipboard

Set channel in transaction mode.

Link copied to clipboard
abstract suspend fun write(vararg frames: Frame)

Internal API to write raw frames to the channel.