RabbitMQMessageQueue class

Message queue that sends and receives messages via RabbitMQ message broker. RabbitMQ is a popular light-weight protocol to communicate. Configuration parameters:

connection(s):

  • discovery_key: (optional) a key to retrieve the connection from IDiscovery
  • host: host name or IP address
  • port: port number
  • uri: resource URI or connection string with all parameters in it
  • credential(s):
  • store_key: (optional) a key to retrieve the credentials from ICredentialStore
  • username: user name
  • password: user password

References:

  • :logger::*:1.0 (optional) ILogger components to pass log messages
  • :counters::*:1.0 (optional) ICounters components to pass collected measurements
  • :discovery::*:1.0 (optional) IDiscovery services to resolve connections
  • :credential-store::*:1.0 (optional) Credential stores to resolve credentials

var queue = RabbitMQMessageQueue('my_queue'); queue.configure(ConfigParams.fromTuples( 'topic', 'mytopic', 'connection.protocol', 'amqp' 'connection.host', 'localhost' 'connection.port', 5672 )); await queue.open('123');

await queue.send('123', MessageEnvelop('123', 'mymessage', 'ABC')); await queue.receive('123', 0); await queue.complete('123', message);

Constructors

RabbitMQMessageQueue(String name, {ConfigParams? config, Channel? mqChanel, String? queue})
Creates a new instance of the message _queue.

Properties

capabilities ↔ MessagingCapabilities
getter/setter pairinherited
connectionResolver ↔ ConnectionResolver
getter/setter pairinherited
counters ↔ CompositeCounters
getter/setter pairinherited
credentialResolver ↔ CredentialResolver
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
interval int
getter/setter pair
logger ↔ CompositeLogger
getter/setter pairinherited
name String
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

abandon(MessageEnvelope message) Future
Returnes message into the queue and makes it available for all subscribers to receive it again. This method is usually used to return a message which could not be processed at the moment to repeat the attempt.Messages that cause unrecoverable errors shall be removed permanently or/and send to dead letter _queue. Parameters:
beginListen(String? correlationId, IMessageReceiver receiver) → void
Listens for incoming messages without blocking the current thread.
inherited
checkOpen(String? correlationId) → void
Checks if the queue has been opened and throws an exception is it's not.
inherited
clear(String? correlationId) Future
Clear method are clears component state. Parameters:
close(String? correlationId) Future
Close method are closes component and frees used resources. Parameters:
complete(MessageEnvelope message) Future
Permanently removes a message from the _queue. This method is usually used to remove the message after successful processing. Parameters:
configure(ConfigParams config) → void
Configures component by passing configuration parameters.
endListen(String? correlationId) Future
Ends listening for incoming messages. When this method is call listen unblocks the thread and execution continues. Parameters:
getCapabilities() → MessagingCapabilities
Gets the queue capabilities
inherited
getName() String
Gets the queue name
inherited
isOpen() bool
Checks if the component is opened. Retruns true if the component has been opened and false otherwise.
listen(String? correlationId, IMessageReceiver receiver) Future
Listens for incoming messages and blocks the current thread until _queue is closed. Parameters:
moveToDeadLetter(MessageEnvelope message) Future
Permanently removes a message from the _queue and sends it to dead letter _queue. Important: This method is not supported by RabbitMQ. Parameters:
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String? correlationId) Future
Opens the component.
inherited
openWithParams(String? correlationId, ConnectionParams? connection, CredentialParams? credential) Future
Opens the component with given _connection and credential parameters.
peek(String? correlationId) Future<MessageEnvelope>
Peeks a single incoming message from the queue without removing it. If there are no messages available in the queue it returns null. Important: This method are not supported in this release! Parameters:
peekBatch(String? correlationId, int messageCount) Future<List<MessageEnvelope>>
PeekBatch method are peeks multiple incoming messages from the _queue without removing them. If there are no messages available in the _queue it returns an empty list. Parameters:
readMessageCount() Future<int>
ReadMessageCount method are reads the current number of messages in the _queue to be delivered. Returns Future that contains count number of messages Throws error.
receive(String? correlationId, int waitTimeout) Future<MessageEnvelope>
Receive method are receives an incoming message and removes it from the _queue. Parameters:
renewLock(MessageEnvelope message, int lockTimeout) Future
Renews a lock on a message that makes it invisible from other receivers in the _queue. This method is usually used to extend the message processing time. Important: This method is not supported by RabbitMQ. Parameters:
send(String? correlationId, MessageEnvelope message) Future
Send method are sends a message into the _queue. Parameters:
sendAsObject(String? correlationId, String messageType, dynamic message) Future
Sends an object into the queue. Before sending the object is converted into JSON string and wrapped in a MessageEnvelope.
inherited
setReferences(IReferences references) → void
Sets references to dependent components.
inherited
toString() String
Gets a string representation of the object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited