IDisposable
Known direct subtypes:
ConnectionBase
Instances of IConnection are used to create fresh sessions/channels. The ConnectionFactory class is used to construct IConnection instances. Please see the documentation for ConnectionFactory for an example of usage. Alternatively, an API tutorial can be found in the User Guide.
Extends the IDisposable interface, so that the "using" statement can be used to scope the lifetime of a channel when appropriate.
| Type | Name | Summary |
|---|---|---|
bool
|
AutoClose
(rw)
|
If true, will close the whole connection as soon as there are no channels open on it; if false, manual connection closure will be required. |
ushort
|
ChannelMax
(r)
|
The maximum number of channels this connection supports (0 if unlimited). |
ShutdownEventArgs
|
CloseReason
(r)
|
Returns null if the connection is still in a state where it can be used, or the cause of its closure otherwise. |
AmqpTcpEndpoint
|
Endpoint
(r)
|
Retrieve the endpoint this connection is connected to. |
uint
|
FrameMax
(r)
|
The maximum frame size this connection supports (0 if unlimited). |
ushort
|
Heartbeat
(r)
|
The current heartbeat setting for this connection (0 for disabled), in seconds. |
bool
|
IsOpen
(r)
|
Returns true if the connection is still in a state where it can be used. Identical to checking if CloseReason == null. |
AmqpTcpEndpoint[]
|
KnownHosts
(r)
|
Returns the known hosts that came back from the broker in the connection.open-ok method at connection startup time. Null until the connection is completely open and ready for use. |
ConnectionParameters
|
Parameters
(r)
|
The connection parameters used during construction of this connection. |
IProtocol
|
Protocol
(r)
|
The IProtocol this connection is using to communicate with its peer. |
| Type | Name | Summary |
|---|---|---|
CallbackExceptionEventHandler
|
CallbackException
|
Signalled when an exception occurs in a callback invoked by the connection. |
ConnectionShutdownEventHandler
|
ConnectionShutdown
|
Raised when the connection is destroyed. |
| Name | Summary |
|---|---|
void Close(ushort reasonCode, string reasonText)
|
Close this connection and all its channels. |
IModel CreateModel()
|
Create and return a fresh channel, session, and model. |
Applications should use the ConnectionShutdown event to avoid race conditions. The scenario to avoid is checking CloseReason, seeing it is null (meaning the IConnection was available for use at the time of the check), and interpreting this mistakenly as a guarantee that the IConnection will remain usable for a time. Instead, the operation of interest should simply be attempted: if the IConnection is not in a usable state, an exception will be thrown (most likely OperationInterruptedException, but may vary depending on the particular operation being attempted).
void Close(ushort reasonCode, string reasonText)
| Return type |
void
|
||||||
|---|---|---|---|---|---|---|---|
| Parameters |
|
IModel CreateModel()
| Return type |
IModel
|
|---|