Implements: IMessageReceiver, ICleanable
Description
The TestMessageReceiver allows you to receive a message, obtain a list of received messages and the number of received messages, and to clear the message list.
Constructors
Creates a TestMessageReceiver component.
NewTestMessageReceiver() *TestMessageReceiver
Properties
GetMessages
Gets the list of received messages.
(c *TestMessageReceiver) GetMessages() []queues.MessageEnvelope
- returns: MessageEnvelope[] - list of received messages
GetMessageCount
Gets the received message count.
(c *TestMessageReceiver) GetMessageCount() int
- returns: int - number of messages
Instance methods
Clear
Clears all received messagers.
(c *TestMessageReceiver) Clear(ctx context.Context) error
- context: IContext - a context to trace execution through a call chain.
ReceiveMessage
Receives incoming message from the queue.
See also MessageEnvelope, IMessageQueue
(c *TestMessageReceiver) ReceiveMessage(ctx context.Context, envelope *queues.MessageEnvelope, queue queues.IMessageQueue) (err error)
- envelope: MessageEnvelope - an incoming message
- queue: IMessageQueue - a queue where the message comes from