Class Connection
The Connection class represents an AMQP connection.
Inherited Members
Namespace: Amqp
Assembly: Amqp.Net.dll
Syntax
public class Connection : AmqpObject, IConnection, IAmqpObject
Constructors
Connection(Address)
Initializes a connection from the address.
Declaration
public Connection(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The address. |
Remarks
The connection initialization includes establishing the underlying transport, which typically has blocking network I/O. Depending on the current synchronization context, it may cause deadlock or UI freeze. Please use the ConnectionFactory.CreateAsync method instead.
Connection(Address, IHandler)
Initializes a connection from the address.
Declaration
public Connection(Address address, IHandler handler)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The address. |
IHandler | handler | The protocol handler. |
Connection(Address, SaslProfile, Open, OnOpened)
Initializes a connection with SASL profile, open and open callback.
Declaration
public Connection(Address address, SaslProfile saslProfile, Open open, OnOpened onOpened)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The address. |
SaslProfile | saslProfile | The SASL profile to do authentication (optional). If it is null and address has user info, SASL PLAIN profile is used. |
Open | open | The open frame to send (optional). If not null, all mandatory fields must be set. Ensure that other fields are set to desired values. |
OnOpened | onOpened | The callback to handle remote open frame (optional). |
Remarks
The connection initialization includes establishing the underlying transport, which typically has blocking network I/O. Depending on the current synchronization context, it may cause deadlock or UI freeze. Please use the ConnectionFactory.CreateAsync method instead.
Fields
DisableServerCertValidation
A flag to disable server certificate validation when TLS is used.
Declaration
public static bool DisableServerCertValidation
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
ConnectionState
Gets the connection state.
Declaration
public ConnectionState ConnectionState { get; }
Property Value
Type | Description |
---|---|
ConnectionState |
Factory
Gets a factory with default settings.
Declaration
public static ConnectionFactory Factory { get; }
Property Value
Type | Description |
---|---|
ConnectionFactory |
Handler
Gets the protocol handler on the connection if it is set.
Declaration
public IHandler Handler { get; }
Property Value
Type | Description |
---|---|
IHandler |
Methods
OnClose(Error)
Closes the connection.
Declaration
protected override bool OnClose(Error error)
Parameters
Type | Name | Description |
---|---|---|
Error | error |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Explicit Interface Implementations
IConnection.CreateSession()
Declaration
ISession IConnection.CreateSession()
Returns
Type | Description |
---|---|
ISession |