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
channelIChannelcancellationTokenCancellationToken
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
channelIChannelqueuestringautoAckboolconsumerIAsyncBasicConsumercancellationTokenCancellationToken
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
channelIChannelqueuestringautoAckboolconsumerTagstringconsumerIAsyncBasicConsumercancellationTokenCancellationToken
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
channelIChannelqueuestringautoAckboolconsumerTagstringargumentsIDictionary<string, object>consumerIAsyncBasicConsumercancellationTokenCancellationToken
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
channelIChannelexchangeCachedStringroutingKeyCachedStringmandatoryboolbodyReadOnlyMemory<byte>cancellationTokenCancellationToken
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
channelIChannelexchangeCachedStringroutingKeyCachedStringbodyReadOnlyMemory<byte>cancellationTokenCancellationToken
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
channelIChannelexchangestringroutingKeystringmandatoryboolbodyReadOnlyMemory<byte>cancellationTokenCancellationToken
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
channelIChannelexchangestringroutingKeystringbodyReadOnlyMemory<byte>cancellationTokenCancellationToken
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
channelIChanneladdrPublicationAddressbasicPropertiesTbodyReadOnlyMemory<byte>cancellationTokenCancellationToken
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
channelIChannelcancellationTokenCancellationToken
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
channelIChannelThe channel.
replyCodeushortThe reply code.
replyTextstringThe reply text.
cancellationTokenCancellationTokenThe 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
channelIChannelexchangestringtypestringdurableboolautoDeleteboolargumentsIDictionary<string, object>noWaitboolcancellationTokenCancellationToken
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
channelIChannelqueuestringdurableboolexclusiveboolautoDeleteboolargumentsIDictionary<string, object>noWaitboolcancellationTokenCancellationToken
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
channelIChannelqueuestringifUnusedboolifEmptyboolcancellationTokenCancellationToken
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
channelIChannelqueuestringexchangestringroutingKeystringargumentsIDictionary<string, object>cancellationTokenCancellationToken