VM Connector Reference - Mule 4
VM Connector v2.0
Anypoint Connector for Virtual Machine (VM) (VM Connector) provides intra-app and inter-app communication through transient or persistent asynchronous queues. Transient queues are faster, but not as reliable as persistent queues if the system crashes. Persistent queues, on the other hand, are slower but reliable.
When running on a single instance, persistent queues work by serializing and storing the contents on to disk. When running in cluster mode, persistent queues are instead backed by the memory grid. This means that when a Mule flow uses VM Connector to publish content to a queue, Mule runtime engine (Mule) decides whether to process that message in the same origin node or to send it out to the cluster to be picked up and processed by another node. This is an easy way to distribute load across the cluster and ensure that transactions are always supported.
Each configuration defines its own set of queues, which are visible only to components referencing that configuration.
Release Notes: VM Connector Release Notes
Configurations
Default Configuration
These are the parameters for the default configuration:
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Name |
String |
The name for this configuration. Connectors reference the configuration with this name. |
x |
|
Connection |
The connection types that can be provided to this configuration. |
x |
||
Queues |
Array of Queue |
The queues that this configuration owns. |
x |
Connection Types
Connection
Returns instances of VMConnection.
Operations
Consume
<vm:consume>
This operation pulls a message from a queue. If a message is not immediately available, the Consume operation waits for up to the configured queueTimeout
value, after which a VM:QUEUE_TIMEOUT
error is thrown.
The flow in which the content is consumed cannot contain a Listener (<vm:listener>
) source.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Transactional Action |
Enumeration, one of:
|
The type of joining action that operations can take regarding transactions. |
JOIN_IF_POSSIBLE |
|
Queue Name |
String |
The name of the queue. |
x |
|
Timeout |
Number |
How long to wait for the queue to complete an operation (either publishing or consuming) before failing with a timeout error. The default is 5 seconds. |
5 |
|
Timeout Unit |
Enumeration, one of:
|
A TimeUnit that qualifies the #timeoutUnit |
SECONDS |
|
Target Variable |
String |
The name of a variable in which the operation’s output is placed. |
||
Target Value |
String |
An expression that evaluates against the operations’s output. The outcome of this expression is stored in the target variable. |
#[payload] |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors. |
Publish
<vm:publish>
This operation publishes the given content into the queue of the given queue name.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Content |
Any |
The content to be published. |
#[payload] |
|
Transactional Action |
Enumeration, one of:
|
The type of joining action that operations can take regarding transactions. |
JOIN_IF_POSSIBLE |
|
Queue Name |
String |
The name of the queue |
x |
|
Timeout |
Number |
How long to wait for the queue to complete an operation (either publishing or consuming) before failing with a timeout error. The default is 5 seconds. |
5 |
|
Timeout Unit |
Enumeration, one of:
|
A TimeUnit that qualifies the #timeoutUnit. |
SECONDS |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors. |
Publish Consume
<vm:publish-consume>
This operation publishes the provided content into a queue, and then waits up to the time configured in queueTimeout
for a response to be supplied on a temporal reply-To queue that this operation creates automatically.
The temporal reply-To queue is automatically disposed of after a response is received or the timeout expires.
The flow in which the content is published cannot contain a Listener (<vm:listener>
) source.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Content |
Any |
The content to be published |
#[payload] |
|
Transactional Action |
Enumeration, one of:
|
The type of joining action that operations can take regarding transactions. |
JOIN_IF_POSSIBLE |
|
Queue Name |
String |
The name of the queue |
x |
|
Timeout |
Number |
How long to wait for the queue to complete an operation (either publishing or consuming) before failing with a timeout error. The default is 5 seconds. |
5 |
|
Timeout Unit |
Enumeration, one of:
|
A TimeUnit that qualifies the #timeoutUnit |
SECONDS |
|
Target Variable |
String |
The name of a variable in which the operation’s output is placed. |
||
Target Value |
String |
An expression to evaluate against the operation’s output and the outcome of that expression is stored in the target variable. |
#[payload] |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors. |
Sources
Listener
<vm:listener>
A source that creates and listens on VM queues. VM queues are created by placing listeners on them, which is why this listener contains parameters for a queue’s behavior, such as whether or not it is persistent, the maximum capacity, and so on.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Number Of Consumers |
Number |
The number of concurrent consumers to place on the queue. As the number of consumers increases, so does the speed at which this source pushes messages into the owning flow. The default is 4 concurrent consumers. |
4 |
|
Transactional Action |
Enumeration, one of:
|
The type of beginning action that sources can take regarding transactions. |
NONE |
|
Transaction Type |
Enumeration, one of:
|
The type of transaction to create. Availability depends on the Mule version. |
LOCAL |
|
Redelivery Policy |
Defines a policy for processing the redelivery of a message. |
|||
Queue Name |
String |
The name of the queue. |
x |
|
Timeout |
Number |
How long to wait for the queue to complete an operation (either publishing or consuming) before failing with a timeout error. The default is 5 seconds. |
|
|
Timeout Unit |
Enumeration, one of:
|
A TimeUnit that qualifies the #timeoutUnit |
|
|
Reconnection Strategy |
A retry strategy in case of connectivity errors. |
|||
Content |
Any |
#[payload] |
Types
Reconnection
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Fails Deployment |
Boolean |
When the application is deployed, a connectivity test is performed on all connectors. If set to |
||
Reconnection Strategy |
The reconnection strategy to use. |
Reconnect
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Frequency |
Number |
How often in milliseconds to reconnect. |
||
Count |
Number |
How many reconnection attempts to make. |
||
blocking |
Boolean |
If |
|
Reconnect Forever
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Frequency |
Number |
How often in milliseconds to reconnect. |
||
blocking |
Boolean |
If |
|
Queue
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Queue Name |
String |
The name of the queue |
x |
|
Queue Type |
Enumeration, one of:
|
Specifies whether the queue is persistent or transient |
|
|
Max Outstanding Messages |
Number |
Specifies the number of messages that can be queued before blocking starts. When the value is |
|
VM Message Attributes
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Queue Name |
String |
Name of the queue the content came from. |
||
Timestamp |
DateTime |
Time that the content was retrieved. |
Redelivery Policy
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max Redelivery Count |
Number |
The maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed message. |
||
Use Secure Hash |
Boolean |
Whether to use a secure hash algorithm to identify a redelivered message. |
||
Message Digest Algorithm |
String |
The secure hashing algorithm to use. If not set, the default is SHA-256. |
||
Id Expression |
String |
Defines one or more expressions to use to determine when a message has been redelivered. This property can be set only if useSecureHash is |
||
Object Store |
ObjectStore |
The object store where the redelivery counter for each message is stored. |