Interface IMessageCreator
Defines a contract for creating various types of messages in a messaging system. Implementations of this interface are responsible for providing methods to create different message types, such as bytes, map, object, stream, and text messages, both with and without initial content. All methods are asynchronous and return tasks that complete with the created message instances.
Namespace: CodersRealm.AmqpClient
Assembly: CodersRealm.AmqpClient.dll
Syntax
public interface IMessageCreator
Methods
CreateBytesMessageAsync()
Creates a new bytes message instance asynchronously.
Declaration
Task<IBytesMessage> CreateBytesMessageAsync()
Returns
| Type | Description |
|---|---|
| Task<IBytesMessage> | A task that completes with the created IBytesMessage. |
CreateBytesMessageAsync(byte[])
Asynchronously creates a new bytes message with the specified body.
Declaration
Task<IBytesMessage> CreateBytesMessageAsync(byte[] body)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | body | The byte array containing the message payload. Cannot be null. |
Returns
| Type | Description |
|---|---|
| Task<IBytesMessage> | A task that represents the asynchronous operation. The task result contains an IBytesMessage instance initialized with the specified body. |
CreateMapMessageAsync()
Creates a new map message instance asynchronously.
Declaration
Task<IMapMessage> CreateMapMessageAsync()
Returns
| Type | Description |
|---|---|
| Task<IMapMessage> | A task that completes with the created IMapMessage. |
CreateMessageAsync()
Creates a generic message instance asynchronously.
Declaration
Task<IMessage> CreateMessageAsync()
Returns
| Type | Description |
|---|---|
| Task<IMessage> | A task that completes with the created IMessage. |
CreateStreamMessageAsync()
Creates a stream message instance asynchronously.
Declaration
Task<IStreamMessage> CreateStreamMessageAsync()
Returns
| Type | Description |
|---|---|
| Task<IStreamMessage> | A task that completes with the created IStreamMessage. |
CreateTextMessageAsync()
Creates an empty text message instance asynchronously.
Declaration
Task<ITextMessage> CreateTextMessageAsync()
Returns
| Type | Description |
|---|---|
| Task<ITextMessage> | A task that completes with the created ITextMessage. |
CreateTextMessageAsync(string)
Creates a text message with the provided text content asynchronously.
Declaration
Task<ITextMessage> CreateTextMessageAsync(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text content for the message. |
Returns
| Type | Description |
|---|---|
| Task<ITextMessage> | A task that completes with the created ITextMessage. |