Class IChannelExtensions
public static class IChannelExtensions
- Inheritance
-
IChannelExtensions
- Inherited Members
Methods
AbortAsync(IChannel, CancellationToken)
Asynchronously abort this session.
public static Task AbortAsync(this IChannel channel, CancellationToken cancellationToken = default)
Parameters
channel
IChannelcancellationToken
CancellationToken
Returns
Remarks
If the session is already closed (or closing), then this method does nothing but wait for the in-progress close operation to complete. This method will not return to the caller until the shutdown is complete. In comparison to normal CloseAsync(IChannel, CancellationToken) method, AbortAsync(IChannel, CancellationToken) will not throw AlreadyClosedException or IOException or any other Exception during closing channel.
BasicConsumeAsync(IChannel, string, bool, IAsyncBasicConsumer, CancellationToken)
Asynchronously start a Basic content-class consumer.
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue, bool autoAck, IAsyncBasicConsumer consumer, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringautoAck
boolconsumer
IAsyncBasicConsumercancellationToken
CancellationToken
Returns
BasicConsumeAsync(IChannel, string, bool, string, IAsyncBasicConsumer, CancellationToken)
Asynchronously start a Basic content-class consumer.
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue, bool autoAck, string consumerTag, IAsyncBasicConsumer consumer, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringautoAck
boolconsumerTag
stringconsumer
IAsyncBasicConsumercancellationToken
CancellationToken
Returns
BasicConsumeAsync(IChannel, string, bool, string, IDictionary<string, object?>?, IAsyncBasicConsumer, CancellationToken)
Asynchronously start a Basic content-class consumer.
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue, bool autoAck, string consumerTag, IDictionary<string, object?>? arguments, IAsyncBasicConsumer consumer, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringautoAck
boolconsumerTag
stringarguments
IDictionary<string, object>consumer
IAsyncBasicConsumercancellationToken
CancellationToken
Returns
BasicPublishAsync(IChannel, CachedString, CachedString, bool, ReadOnlyMemory<byte>, CancellationToken)
(Extension method) Convenience overload of BasicPublishAsync<TProperties>(CachedString, CachedString, bool, TProperties, ReadOnlyMemory<byte>, CancellationToken)
public static ValueTask BasicPublishAsync(this IChannel channel, CachedString exchange, CachedString routingKey, bool mandatory, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default)
Parameters
channel
IChannelexchange
CachedStringroutingKey
CachedStringmandatory
boolbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
Remarks
The publication occurs with empty BasicProperties
BasicPublishAsync(IChannel, CachedString, CachedString, ReadOnlyMemory<byte>, CancellationToken)
(Extension method) Convenience overload of BasicPublishAsync<TProperties>(CachedString, CachedString, bool, TProperties, ReadOnlyMemory<byte>, CancellationToken)
public static ValueTask BasicPublishAsync(this IChannel channel, CachedString exchange, CachedString routingKey, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default)
Parameters
channel
IChannelexchange
CachedStringroutingKey
CachedStringbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
Remarks
The publication occurs with mandatory=false and empty BasicProperties
BasicPublishAsync(IChannel, string, string, bool, ReadOnlyMemory<byte>, CancellationToken)
(Extension method) Convenience overload of BasicPublishAsync<TProperties>(string, string, bool, TProperties, ReadOnlyMemory<byte>, CancellationToken)
public static ValueTask BasicPublishAsync(this IChannel channel, string exchange, string routingKey, bool mandatory, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default)
Parameters
channel
IChannelexchange
stringroutingKey
stringmandatory
boolbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
Remarks
The publication occurs with empty BasicProperties
BasicPublishAsync(IChannel, string, string, ReadOnlyMemory<byte>, CancellationToken)
(Extension method) Convenience overload of BasicPublishAsync<TProperties>(string, string, bool, TProperties, ReadOnlyMemory<byte>, CancellationToken)
public static ValueTask BasicPublishAsync(this IChannel channel, string exchange, string routingKey, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default)
Parameters
channel
IChannelexchange
stringroutingKey
stringbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
Remarks
The publication occurs with mandatory=false and empty BasicProperties
BasicPublishAsync<T>(IChannel, PublicationAddress, T, ReadOnlyMemory<byte>, CancellationToken)
(Extension method) Convenience overload of BasicPublishAsync<TProperties>(string, string, bool, TProperties, ReadOnlyMemory<byte>, CancellationToken)
public static ValueTask BasicPublishAsync<T>(this IChannel channel, PublicationAddress addr, T basicProperties, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default) where T : IReadOnlyBasicProperties, IAmqpHeader
Parameters
channel
IChanneladdr
PublicationAddressbasicProperties
Tbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
Type Parameters
T
Remarks
The publication occurs with mandatory=false.
CloseAsync(IChannel, CancellationToken)
Asynchronously close this session.
public static Task CloseAsync(this IChannel channel, CancellationToken cancellationToken = default)
Parameters
channel
IChannelcancellationToken
CancellationToken
Returns
Remarks
If the session is already closed (or closing), then this method does nothing but wait for the in-progress close operation to complete. This method will not return to the caller until the shutdown is complete.
CloseAsync(IChannel, ushort, string, CancellationToken)
Asynchronously close this channel.
public static Task CloseAsync(this IChannel channel, ushort replyCode, string replyText, CancellationToken cancellationToken = default)
Parameters
channel
IChannelThe channel.
replyCode
ushortThe reply code.
replyText
stringThe reply text.
cancellationToken
CancellationTokenThe cancellation token.
Returns
Remarks
The method behaves in the same way as CloseAsync(), with the only difference that the channel is closed with the given channel close code and message.
The close code (See under "Reply Codes" in the AMQP specification)
A message indicating the reason for closing the channel
ExchangeDeclareAsync(IChannel, string, string, bool, bool, IDictionary<string, object?>?, bool, CancellationToken)
Asynchronously declare an exchange.
public static Task ExchangeDeclareAsync(this IChannel channel, string exchange, string type, bool durable = false, bool autoDelete = false, IDictionary<string, object?>? arguments = null, bool noWait = false, CancellationToken cancellationToken = default)
Parameters
channel
IChannelexchange
stringtype
stringdurable
boolautoDelete
boolarguments
IDictionary<string, object>noWait
boolcancellationToken
CancellationToken
Returns
QueueDeclareAsync(IChannel, string, bool, bool, bool, IDictionary<string, object?>?, bool, CancellationToken)
Asynchronously declare a queue.
public static Task<QueueDeclareOk> QueueDeclareAsync(this IChannel channel, string queue = "", bool durable = false, bool exclusive = true, bool autoDelete = true, IDictionary<string, object?>? arguments = null, bool noWait = false, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringdurable
boolexclusive
boolautoDelete
boolarguments
IDictionary<string, object>noWait
boolcancellationToken
CancellationToken
Returns
QueueDeleteAsync(IChannel, string, bool, bool, CancellationToken)
Asynchronously deletes a queue.
public static Task<uint> QueueDeleteAsync(this IChannel channel, string queue, bool ifUnused = false, bool ifEmpty = false, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringifUnused
boolifEmpty
boolcancellationToken
CancellationToken
Returns
QueueUnbindAsync(IChannel, string, string, string, IDictionary<string, object?>?, CancellationToken)
Asynchronously unbinds a queue.
public static Task QueueUnbindAsync(this IChannel channel, string queue, string exchange, string routingKey, IDictionary<string, object?>? arguments = null, CancellationToken cancellationToken = default)
Parameters
channel
IChannelqueue
stringexchange
stringroutingKey
stringarguments
IDictionary<string, object>cancellationToken
CancellationToken