public interface IModel

Summary

Common AMQP model, spanning the union of the functionality offered by versions 0-8, 0-8qpid, and 0-9 (without WIP) of AMQP.

Remarks

Extends the IDisposable interface, so that the "using" statement can be used to scope the lifetime of a channel when appropriate.

Property Summary

Type Name Summary
ShutdownEventArgs CloseReason (r)

Returns null if the session is still in a state where it can be used, or the cause of its closure otherwise.

IBasicConsumer DefaultConsumer (rw)

Signalled when an unexpected message is delivered Under certain circumstances it is possible for a channel to receive a message delivery which does not match any consumer which is currently set up via basicConsume(). This will occur after the following sequence of events: ctag = basicConsume(queue, consumer); // i.e. with explicit acks // some deliveries take place but are not acked basicCancel(ctag); basicRecover(false); Since requeue is specified to be false in the basicRecover, the spec states that the message must be redelivered to "the original recipient" - i.e. the same channel / consumer-tag. But the consumer is no longer active. In these circumstances, you can register a default consumer to handle such deliveries. If no default consumer is registered an InvalidOperationException will be thrown when such a delivery arrives. Most people will not need to use this.

bool IsOpen (r)

Returns true if the session is still in a state where it can be used. Identical to checking if CloseReason == null.

Event Summary

Type Name Summary
BasicReturnEventHandler BasicReturn

Signalled when a Basic.Return command arrives from the broker.

CallbackExceptionEventHandler CallbackException

Signalled when an exception occurs in a callback invoked by the model.

ModelShutdownEventHandler ModelShutdown

Notifies the destruction of the model.

Method Summary

Name Summary
void Abort()

Abort this session.

void Abort(ushort replyCode, string replyText)

Abort this session.

void BasicAck(ulong deliveryTag, bool multiple)

(Spec method) Acknowledge one or more delivered message(s).

void BasicCancel(string consumerTag)

Delete a Basic content-class consumer.

string BasicConsume(string queue, IDictionary filter, IBasicConsumer consumer)

Start a Basic content-class consumer.

string BasicConsume(string queue, bool noAck, IDictionary filter, IBasicConsumer consumer)

Start a Basic content-class consumer.

string BasicConsume(string queue, bool noAck, string consumerTag, bool noLocal, bool exclusive, IDictionary filter, IBasicConsumer consumer)

Start a Basic content-class consumer.

string BasicConsume(string queue, bool noAck, string consumerTag, IDictionary filter, IBasicConsumer consumer)

Start a Basic content-class consumer.

BasicGetResult BasicGet(string queue, bool noAck)

(Spec method) Retrieve an individual message, if one is available; returns null if the server answers that no messages are currently available. See also IModel.BasicAck.

void BasicPublish(string exchange, string routingKey, IBasicProperties basicProperties, byte[] body)

(Spec method) Convenience overload of BasicPublish.

void BasicPublish(string exchange, string routingKey, bool mandatory, bool immediate, IBasicProperties basicProperties, byte[] body)

(Spec method) Publish a message using the Basic content-class.

void BasicPublish(PublicationAddress addr, IBasicProperties basicProperties, byte[] body)

(Spec method) Convenience overload of BasicPublish.

void BasicQos(uint prefetchSize, ushort prefetchCount, bool global)

(Spec method) Configures QoS parameters of the Basic content-class.

void BasicRecover(bool requeue)

(Spec method)

void BasicReject(ulong deliveryTag, bool requeue)

(Spec method) Reject a delivered message.

void ChannelFlow(bool active)

(Spec method) Channel flow control functionality.

void Close(ushort replyCode, string replyText)

Close this session.

void Close()

Close this session.

IBasicProperties CreateBasicProperties()

Construct a completely empty content header for use with the Basic content class.

IFileProperties CreateFileProperties()

Construct a completely empty content header for use with the File content class.

IStreamProperties CreateStreamProperties()

Construct a completely empty content header for use with the Stream content class.

void DtxSelect()

(Spec method) Enable DTX mode for this session.

void DtxStart(string dtxIdentifier)

(Spec method)

void ExchangeDeclare(string exchange, string type)

(Spec method) Declare an exchange.

void ExchangeDeclare(string exchange, string type, bool durable)

(Spec method) Declare an exchange.

void ExchangeDeclare(string exchange, string type, bool passive, bool durable, bool autoDelete, bool internal, bool nowait, IDictionary arguments)

(Spec method) Declare an exchange.

void ExchangeDelete(string exchange, bool ifUnused, bool nowait)

(Spec method) Delete an exchange.

void QueueBind(string queue, string exchange, string routingKey, bool nowait, IDictionary arguments)

(Spec method) Bind a queue to an exchange.

string QueueDeclare(string queue, bool durable)

(Spec method) Declare a queue.

string QueueDeclare(string queue, bool passive, bool durable, bool exclusive, bool autoDelete, bool nowait, IDictionary arguments)

(Spec method) Declare a queue.

string QueueDeclare()

(Spec method) Declare a queue.

string QueueDeclare(string queue)

(Spec method) Declare a queue.

uint QueueDelete(string queue, bool ifUnused, bool ifEmpty, bool nowait)

(Spec method) Delete a queue.

uint QueuePurge(string queue, bool nowait)

(Spec method) Purge a queue of messages.

void QueueUnbind(string queue, string exchange, string routingKey, IDictionary arguments)

(Spec method) Unbind a queue from an exchange.

void TxCommit()

(Spec method) Commit this session's active TX transaction.

void TxRollback()

(Spec method) Roll back this session's active TX transaction.

void TxSelect()

(Spec method) Enable TX mode for this session.

Property Detail

ShutdownEventArgs CloseReason (r)

Summary

Returns null if the session is still in a state where it can be used, or the cause of its closure otherwise.

IBasicConsumer DefaultConsumer (rw)

Summary

Signalled when an unexpected message is delivered Under certain circumstances it is possible for a channel to receive a message delivery which does not match any consumer which is currently set up via basicConsume(). This will occur after the following sequence of events: ctag = basicConsume(queue, consumer); // i.e. with explicit acks // some deliveries take place but are not acked basicCancel(ctag); basicRecover(false); Since requeue is specified to be false in the basicRecover, the spec states that the message must be redelivered to "the original recipient" - i.e. the same channel / consumer-tag. But the consumer is no longer active. In these circumstances, you can register a default consumer to handle such deliveries. If no default consumer is registered an InvalidOperationException will be thrown when such a delivery arrives. Most people will not need to use this.

bool IsOpen (r)

Summary

Returns true if the session is still in a state where it can be used. Identical to checking if CloseReason == null.

Event Detail

BasicReturnEventHandler BasicReturn

Summary

Signalled when a Basic.Return command arrives from the broker.

CallbackExceptionEventHandler CallbackException

Summary

Signalled when an exception occurs in a callback invoked by the model.

Remarks

Examples of cases where this event will be signalled include exceptions thrown in IBasicConsumer methods, or exceptions thrown in ModelShutdownEventHandler delegates etc.

ModelShutdownEventHandler ModelShutdown

Summary

Notifies the destruction of the model.

Remarks

If the model is already destroyed at the time an event handler is added to this event, the event handler will be fired immediately.

Method Detail

Abort

void Abort()

Return type void

Summary

Abort this session.

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 Close() method, Abort() will not throw AlreadyClosedException or IOException during closing model.

Abort

void Abort(ushort replyCode, string replyText)

Return type void
Parameters
Name Type
replyCode ushort
replyText string

Summary

Abort this session.

Remarks

The method behaves in the same way as Abort(), with the only difference that the model is closed with the given model close code and message.

The close code (See under "Reply Codes" in the AMQP specification)

A message indicating the reason for closing the model

BasicAck

void BasicAck(ulong deliveryTag, bool multiple)

Return type void
Parameters
Name Type
deliveryTag ulong
multiple bool

Summary

(Spec method) Acknowledge one or more delivered message(s).

BasicCancel

void BasicCancel(string consumerTag)

Return type void
Parameters
Name Type
consumerTag string

Summary

Delete a Basic content-class consumer.

BasicConsume

string BasicConsume(string queue, IDictionary filter, IBasicConsumer consumer)

Return type string
Parameters
Name Type
queue string
filter IDictionary
consumer IBasicConsumer

Summary

Start a Basic content-class consumer.

Remarks

The consumer is started with noAck=false (i.e. BasicAck is required), an empty consumer tag (i.e. the server creates and returns a fresh consumer tag), noLocal=false and exclusive=false.

BasicConsume

string BasicConsume(string queue, bool noAck, IDictionary filter, IBasicConsumer consumer)

Return type string
Parameters
Name Type
queue string
noAck bool
filter IDictionary
consumer IBasicConsumer

Summary

Start a Basic content-class consumer.

Remarks

The consumer is started with an empty consumer tag (i.e. the server creates and returns a fresh consumer tag), noLocal=false and exclusive=false.

BasicConsume

string BasicConsume(string queue, bool noAck, string consumerTag, bool noLocal, bool exclusive, IDictionary filter, IBasicConsumer consumer)

Return type string
Parameters
Name Type
queue string
noAck bool
consumerTag string
noLocal bool
exclusive bool
filter IDictionary
consumer IBasicConsumer

Summary

Start a Basic content-class consumer.

BasicConsume

string BasicConsume(string queue, bool noAck, string consumerTag, IDictionary filter, IBasicConsumer consumer)

Return type string
Parameters
Name Type
queue string
noAck bool
consumerTag string
filter IDictionary
consumer IBasicConsumer

Summary

Start a Basic content-class consumer.

Remarks

The consumer is started with noLocal=false and exclusive=false.

BasicGet

BasicGetResult BasicGet(string queue, bool noAck)

Return type BasicGetResult
Parameters
Name Type
queue string
noAck bool

Summary

(Spec method) Retrieve an individual message, if one is available; returns null if the server answers that no messages are currently available. See also IModel.BasicAck.

BasicPublish

void BasicPublish(string exchange, string routingKey, IBasicProperties basicProperties, byte[] body)

Return type void
Parameters
Name Type
exchange string
routingKey string
basicProperties IBasicProperties
body byte[]

Summary

(Spec method) Convenience overload of BasicPublish.

Remarks

The publication occurs with mandatory=false and immediate=false.

BasicPublish

void BasicPublish(string exchange, string routingKey, bool mandatory, bool immediate, IBasicProperties basicProperties, byte[] body)

Return type void
Parameters
Name Type
exchange string
routingKey string
mandatory bool
immediate bool
basicProperties IBasicProperties
body byte[]

Summary

(Spec method) Publish a message using the Basic content-class.

BasicPublish

void BasicPublish(PublicationAddress addr, IBasicProperties basicProperties, byte[] body)

Return type void
Parameters
Name Type
addr PublicationAddress
basicProperties IBasicProperties
body byte[]

Summary

(Spec method) Convenience overload of BasicPublish.

Remarks

The publication occurs with mandatory=false and immediate=false.

BasicQos

void BasicQos(uint prefetchSize, ushort prefetchCount, bool global)

Return type void
Parameters
Name Type
prefetchSize uint
prefetchCount ushort
global bool

Summary

(Spec method) Configures QoS parameters of the Basic content-class.

BasicRecover

void BasicRecover(bool requeue)

Return type void
Parameters
Name Type
requeue bool

Summary

(Spec method)

BasicReject

void BasicReject(ulong deliveryTag, bool requeue)

Return type void
Parameters
Name Type
deliveryTag ulong
requeue bool

Summary

(Spec method) Reject a delivered message.

ChannelFlow

void ChannelFlow(bool active)

Return type void
Parameters
Name Type
active bool

Summary

(Spec method) Channel flow control functionality.

Remarks

Close

void Close(ushort replyCode, string replyText)

Return type void
Parameters
Name Type
replyCode ushort
replyText string

Summary

Close this session.

Remarks

The method behaves in the same way as Close(), with the only difference that the model is closed with the given model close code and message.

The close code (See under "Reply Codes" in the AMQP specification)

A message indicating the reason for closing the model

Close

void Close()

Return type void

Summary

Close this session.

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.

CreateBasicProperties

IBasicProperties CreateBasicProperties()

Return type IBasicProperties

Summary

Construct a completely empty content header for use with the Basic content class.

CreateFileProperties

IFileProperties CreateFileProperties()

Return type IFileProperties

Summary

Construct a completely empty content header for use with the File content class.

CreateStreamProperties

IStreamProperties CreateStreamProperties()

Return type IStreamProperties

Summary

Construct a completely empty content header for use with the Stream content class.

DtxSelect

void DtxSelect()

Return type void

Summary

(Spec method) Enable DTX mode for this session.

DtxStart

void DtxStart(string dtxIdentifier)

Return type void
Parameters
Name Type
dtxIdentifier string

Summary

(Spec method)

ExchangeDeclare

void ExchangeDeclare(string exchange, string type)

Return type void
Parameters
Name Type
exchange string
type string

Summary

(Spec method) Declare an exchange.

Remarks

The exchange is declared non-passive, non-durable, non-autodelete, and non-internal, with no arguments. The "nowait" option is not exercised.

ExchangeDeclare

void ExchangeDeclare(string exchange, string type, bool durable)

Return type void
Parameters
Name Type
exchange string
type string
durable bool

Summary

(Spec method) Declare an exchange.

Remarks

The exchange is declared non-passive, non-autodelete, and non-internal, with no arguments. The "nowait" option is not exercised.

ExchangeDeclare

void ExchangeDeclare(string exchange, string type, bool passive, bool durable, bool autoDelete, bool internal, bool nowait, IDictionary arguments)

Return type void
Parameters
Name Type
exchange string
type string
passive bool
durable bool
autoDelete bool
internal bool
nowait bool
arguments IDictionary

Summary

(Spec method) Declare an exchange.

ExchangeDelete

void ExchangeDelete(string exchange, bool ifUnused, bool nowait)

Return type void
Parameters
Name Type
exchange string
ifUnused bool
nowait bool

Summary

(Spec method) Delete an exchange.

QueueBind

void QueueBind(string queue, string exchange, string routingKey, bool nowait, IDictionary arguments)

Return type void
Parameters
Name Type
queue string
exchange string
routingKey string
nowait bool
arguments IDictionary

Summary

(Spec method) Bind a queue to an exchange.

QueueDeclare

string QueueDeclare(string queue, bool durable)

Return type string
Parameters
Name Type
queue string
durable bool

Summary

(Spec method) Declare a queue.

Remarks

The queue is declared non-passive, non-exclusive, and non-autodelete, with no arguments.

QueueDeclare

string QueueDeclare(string queue, bool passive, bool durable, bool exclusive, bool autoDelete, bool nowait, IDictionary arguments)

Return type string
Parameters
Name Type
queue string
passive bool
durable bool
exclusive bool
autoDelete bool
nowait bool
arguments IDictionary

Summary

(Spec method) Declare a queue.

Remarks

Returns the name of the queue that was declared.

QueueDeclare

string QueueDeclare()

Return type string

Summary

(Spec method) Declare a queue.

Remarks

The queue is declared non-passive, non-durable, but exclusive and autodelete, with no arguments. The server autogenerates a name for the queue - the generated name is the return value of this method.

QueueDeclare

string QueueDeclare(string queue)

Return type string
Parameters
Name Type
queue string

Summary

(Spec method) Declare a queue.

Remarks

The queue is declared non-passive, non-durable, non-exclusive, and non-autodelete, with no arguments.

QueueDelete

uint QueueDelete(string queue, bool ifUnused, bool ifEmpty, bool nowait)

Return type uint
Parameters
Name Type
queue string
ifUnused bool
ifEmpty bool
nowait bool

Summary

(Spec method) Delete a queue.

Remarks

Returns the number of messages purged during queue deletion. If nowait is specified, returns
uint.MaxValue
.

QueuePurge

uint QueuePurge(string queue, bool nowait)

Return type uint
Parameters
Name Type
queue string
nowait bool

Summary

(Spec method) Purge a queue of messages.

Remarks

Returns the number of messages purged. If nowait is specified, returns
uint.MaxValue
.

QueueUnbind

void QueueUnbind(string queue, string exchange, string routingKey, IDictionary arguments)

Return type void
Parameters
Name Type
queue string
exchange string
routingKey string
arguments IDictionary

Summary

(Spec method) Unbind a queue from an exchange.

Remarks

Note: This operation is only supported when communicating using AMQP protocol version 0-9, or when communicating with a 0-8 broker that has been enhanced with the unofficial addition of a queue.unbind method.

TxCommit

void TxCommit()

Return type void

Summary

(Spec method) Commit this session's active TX transaction.

TxRollback

void TxRollback()

Return type void

Summary

(Spec method) Roll back this session's active TX transaction.

TxSelect

void TxSelect()

Return type void

Summary

(Spec method) Enable TX mode for this session.