Class ListenerLink
The listener link provides non-blocking methods that can be used by brokers/listener applications.
Inherited Members
Namespace: Amqp.Listener
Assembly: Amqp.Net.dll
Syntax
public class ListenerLink : Link, ILink, IAmqpObjectConstructors
ListenerLink(ListenerSession, Attach)
Initializes a listener link object.
Declaration
public ListenerLink(ListenerSession session, Attach attach)Parameters
| Type | Name | Description | 
|---|---|---|
| ListenerSession | session | The session. | 
| Attach | attach | The received attach frame. | 
Properties
Role
Gets the sender (false) or receiver (true) role of the link.
Declaration
public bool Role { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
SettleOnSend
Gets the settled flag. If it is true, messages are sent settled.
Declaration
public bool SettleOnSend { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
State
Gets the user state attached to the link when it is initialized.
Declaration
public object State { get; }Property Value
| Type | Description | 
|---|---|
| System.Object | 
Methods
CompleteAttach(Attach, Error)
Completes the link attach request. This should be called when the IContainer.AttachLink implementation returns false and the asynchronous processing completes.
Declaration
public void CompleteAttach(Attach attach, Error error)Parameters
| Type | Name | Description | 
|---|---|---|
| Attach | attach | The attach to send back. | 
| Error | error | The error, if any, for the link. | 
DisposeMessage(Message, DeliveryState, Boolean)
Sends a disposition for the message.
Declaration
public void DisposeMessage(Message message, DeliveryState deliveryState, bool settled)Parameters
| Type | Name | Description | 
|---|---|---|
| Message | message | The message to be disposed (a disposition performative will be sent for this message). | 
| DeliveryState | deliveryState | The delivery state to set on disposition. | 
| System.Boolean | settled | The settled flag on disposition. | 
InitializeReceiver(UInt32, Action<ListenerLink, Message, DeliveryState, Object>, Object)
Initializes the receiver state for the link.
Declaration
public void InitializeReceiver(uint credit, Action<ListenerLink, Message, DeliveryState, object> onMessage, object state)Parameters
| Type | Name | Description | 
|---|---|---|
| System.UInt32 | credit | The link credit to send to the peer. | 
| System.Action<ListenerLink, Message, DeliveryState, System.Object> | onMessage | The callback to be invoked for received messages. | 
| System.Object | state | The user state attached to the link. | 
InitializeSender(Action<Int32, Fields, Object>, Action<Message, DeliveryState, Boolean, Object>, Object)
Initializes the sender state for the link.
Declaration
public void InitializeSender(Action<int, Fields, object> onCredit, Action<Message, DeliveryState, bool, object> onDispose, object state)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Action<System.Int32, Fields, System.Object> | onCredit | The callback to be invoked when delivery limit changes (by received flow performatives). | 
| System.Action<Message, DeliveryState, System.Boolean, System.Object> | onDispose | The callback to be invoked when disposition is received. | 
| System.Object | state | The user state attached to the link. | 
OnAbort(Error)
Aborts the link.
Declaration
protected override void OnAbort(Error error)Parameters
| Type | Name | Description | 
|---|---|---|
| Error | error | The error. | 
Overrides
OnClose(Error)
Closes the link.
Declaration
protected override bool OnClose(Error error)Parameters
| Type | Name | Description | 
|---|---|---|
| Error | error | The error | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
Overrides
SendMessage(Message)
Sends a message. This call is non-blocking and it does not wait for acknowledgments.
Declaration
public void SendMessage(Message message)Parameters
| Type | Name | Description | 
|---|---|---|
| Message | message | 
SendMessage(Message, ByteBuffer)
Sends a message with an optional buffer as the message payload.
Declaration
public void SendMessage(Message message, ByteBuffer buffer)Parameters
| Type | Name | Description | 
|---|---|---|
| Message | message | The message to be sent. | 
| ByteBuffer | buffer | The serialized buffer of the message. It is null, the message is serialized. | 
SetCredit(Int32, Boolean, Boolean)
Sets a credit on the link. A flow is sent to the peer to update link flow control state.
Declaration
public void SetCredit(int credit, bool drain, bool autoRestore = true)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | credit | The new link credit. | 
| System.Boolean | drain | Sets the drain flag in the flow performative. | 
| System.Boolean | autoRestore | If true, link credit is auto-restored when a message is accepted/rejected by the caller. If false, caller is responsible for manage link credits. |