Interface IMessageChannel
An abstraction that defines methods for sending messages;
Namespace: Steeltoe.Messaging
Assembly: Steeltoe.Messaging.Abstractions.dll
Syntax
public interface IMessageChannel
Methods
| Edit this page View SourceSend(IMessage)
Send a message to this channel. If the message is sent successfuly, the method returns true. If the message cannot be sent due to a non-fatal reason, the method returns false. The method may also throw a Exception in case of non-recoverable errors. This method may block indefinitely, depending on the implementation.
Declaration
bool Send(IMessage message)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | the message to send |
Returns
Type | Description |
---|---|
System.Boolean | true if the message is sent |
Send(IMessage, Int32)
Send a message, blocking until either the message is accepted or the specified timeout period elapses.
Declaration
bool Send(IMessage message, int timeout)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | the message to send |
System.Int32 | timeout | the timeout in milliseconds; -1 for no timeout |
Returns
Type | Description |
---|---|
System.Boolean | true if the message is sent |
SendAsync(IMessage, CancellationToken)
Send a message to this channel.
Declaration
ValueTask<bool> SendAsync(IMessage message, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | the message to send |
CancellationToken | cancellationToken | token used to signal cancellation |
Returns
Type | Description |
---|---|
ValueTask<System.Boolean> | a task to signal completion |