In Memory (VM) Transport Reference
Introduction
The In Memory transport can be used for intra-JVM communication between Mule Flows. This transport by default uses in-memory queues but can optionally be configured to use persistent queues.
Transport Info
| Transport | Doc | Inbound | Outbound | Request | Transactions | Streaming | Retries | MEPs | Default MEP | Maven Artifact |
|---|---|---|---|---|---|---|---|---|---|---|
| Multicast | JavaDoc SchemaDoc | one-way, request-response | request-response | org.mule.transport:mule-transport-multicast |
Namespace and Syntax
XML namespace:
XML Schema Location:
Connector syntax:
VM with persistent queues:
VM with in-memory queues (or no queue, for request-response endpoints):
Endpoint Syntax:
- Prefixed endpoint:
- Non-prefixed URI:
Transformers
There are no specific transformers for the VM transport.
Considerations
The VM transport has often been used to implement complex integrations made up of multiple applications. Improvements in Mule 3 obviate the need for VM in many cases.
Because of the introduction of MessageProcessor in most Mule elements, you can accomplish more complex integrations without using the VM transport for communication. You can use Flow References to directly reference one flow from another without a transport in the middle.
VM is still useful in certain situations. Suppose, for instance, that most of the parts of your solution are local, but some will need to be decoupled for testing, or because some will need to be made remote.
| WARNING Each application in a Mule instance has its own, unique set of VM endpoints. Thus the VM transport cannot be used to communicate between different Mule applications. |
Features
The in memory (VM) transport has two modes of operation: One for use with request-response and another for use with one-way endpoints. (See MEPs for more information.)
request-response:
When using request-response endpoints, messages are delivered directly from an outbound vm endpoint to the inbound vm endpoint that is listening on the same path. This delivery is blocking and occurs in the same thread. If there is no inbound request-response vm endpoint in the same Mule application listening on this path, then dispatching of the message from the outbound endpoint will fail.
one-way:
When using one-way endpoints, messages are delivered to the corresponding inbound endpoint via a queue. This delivery is non-blocking. If there is no inbound one-way endpoint in the same Mule application listening on this path, then, although dispatching of the message will succeed, the message will remain in the queue. By default, this queue is in memory, but it is also possible to configure a persistent queue that will use the file system as its persistence mechanism.
| NOTE You cannot send a message from a request-response endpoint to a one-way endpoint or the other way around. This will either cause the send to fail or the message will stay in the queue and never arrive at the expected destination. |
Usage
To use VM endpoints
- Add the MULE VM namespace to your configuration:
- Define the vm prefix using xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
- Define the schema location with http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd
- Optionally, define one or more connectors for VM endpoints.
Create a VM connector:
If none is created, all VM endpoints will use a defaulte connector.
- Create VM endpoints.
- Messages will be received on inbound endpoints.
- Messages will be sent to outbound endpoints.
- Both kinds of endpoints are identified by a path name.
Namespace Declaration
To use the VM transport, you must declare the VM namespace in the header of the Mule configuration file. For example:
Connector Configuration
The configuration of the VM connector is optional. Configuring a connector allows you to configure a Queue Profile which will allow persistence to be used. You can also set the maximum queue size.
Endpoints
Endpoints are configured as with all transports.
The VM transport specific endpoints are configured using the vm namespace and use a path attribute. For example:
If you need to invoke a VM endpoint from Mule Client, use an Endpoint URI. The format of an endpoint uri for VM is as follows:
Using Transactions
one-way VM queues can take part in distributed XA Transactions. To make a VM endpoint transactional, use a configuration like the following:
Using XA requires that you add a transaction manager to your configuration. For more information, see Transaction Management.
Transactional Inbound VM Queues
Inbound VM endpoints support fully transactional flows. For instance, the following configuration will create a VM queue (because the inbound endpoint is one-way), and process messages read from this queue synchronously and transactionally:
XA transactions are also supported:
Example Configurations
The first connector ❶ uses default connector configuration.
The second connector ❷ configures a queue profile and queueTimeout.
The flow uses two VM endpoints, the inbound endpoint ❸ uses a request-response exchange pattern. The outbound endpoint ❹ use a one-way endpoint as well as an alternative connector with persistence configured.
Configuration Reference
Element Listing
VM Transport
The VM transport is used for intra-VM communication between components managed by Mule. The transport provides options for configuring VM transient or persistent queues.
Connector
Attributes of <connector...>
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
name |
name (no spaces) |
yes |
|
Identifies the connector so that other elements can reference it. |
name |
name (no spaces) |
yes |
|
Identifies the connector so that other elements can reference it. |
dynamicNotification |
boolean |
no |
false |
Enables dynamic notifications for notifications fired by this connector. This allows listeners to be registered dynamically at runtime via the MuleContext, and the configured notification can be changed. This overrides the default value defined in the 'configuration' element. |
validateConnections |
boolean |
no |
true |
Causes Mule to validate connections before use. Note that this is only a configuration hint, transport implementations may or may not make an extra effort to validate the connection. Default is true. |
dispatcherPoolFactory-ref |
string |
no |
|
Allows Spring beans to be defined as a dispatcher pool factory |
name |
name (no spaces) |
yes |
|
Identifies the connector so that other elements can reference it. |
name |
name (no spaces) |
yes |
|
Identifies the connector so that other elements can reference it. |
dynamicNotification |
boolean |
no |
false |
Enables dynamic notifications for notifications fired by this connector. This allows listeners to be registered dynamically at runtime via the MuleContext, and the configured notification can be changed. This overrides the default value defined in the 'configuration' element. |
validateConnections |
boolean |
no |
true |
Causes Mule to validate connections before use. Note that this is only a configuration hint, transport implementations may or may not make an extra effort to validate the connection. Default is true. |
dispatcherPoolFactory-ref |
string |
no |
|
Allows Spring beans to be defined as a dispatcher pool factory |
createMultipleTransactedReceivers |
boolean |
no |
|
Whether to create multiple concurrent receivers for this connector. This property is used by transports that support transactions, specifically receivers that extend the TransactedPollingMessageReceiver, and provides better throughput. |
numberOfConcurrentTransactedReceivers |
integer |
no |
|
If createMultipleTransactedReceivers is set to true, the number of concurrent receivers that will be launched. |
queueTimeout |
positiveInteger |
no |
|
The timeout setting for the queue used for asynchronous endpoints |
Child Elements of <connector...>
Name |
Cardinality |
Description |
|---|---|---|
spring:property |
0..* |
|
receiver-threading-profile |
0..1 |
The threading profile to use when a connector receives messages. |
dispatcher-threading-profile |
0..1 |
The threading profile to use when a connector dispatches messages. |
abstract-reconnection-strategy |
0..1 |
Reconnection strategy that defines how Mule should handle a connection failure. A placeholder for a reconnection strategy element. Reconnection strategies define how Mule should attempt to handle a connection failure. |
service-overrides |
0..1 |
Service overrides allow the connector to be further configured/customized by allowing parts of the transport implementation to be overridden, for example, the message receiver or dispatcher implementation, or the message adaptor that is used. |
spring:property |
0..* |
|
receiver-threading-profile |
0..1 |
The threading profile to use when a connector receives messages. |
dispatcher-threading-profile |
0..1 |
The threading profile to use when a connector dispatches messages. |
abstract-reconnection-strategy |
0..1 |
Reconnection strategy that defines how Mule should handle a connection failure. A placeholder for a reconnection strategy element. Reconnection strategies define how Mule should attempt to handle a connection failure. |
service-overrides |
0..1 |
Service overrides allow the connector to be further configured/customized by allowing parts of the transport implementation to be overridden, for example, the message receiver or dispatcher implementation, or the message adaptor that is used. |
queueProfile |
0..1 |
DEPRECATED. USE "<queue-profile>" instead. |
queue-profile |
0..1 |
Configures the properties of this connector's queue (see Configuring Queues). |
Inbound endpoint
The endpoint on which this connector receives messages from the transport.
Attributes of <inbound-endpoint...>
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
name |
name (no spaces) |
no |
|
Identifies the endpoint in the registry. There is no need to set the 'name' attribute on inbound or outbound endpoints, only on global endpoints. |
name |
name (no spaces) |
no |
|
Identifies the endpoint in the registry. There is no need to set the 'name' attribute on inbound or outbound endpoints, only on global endpoints. |
ref |
string |
no |
|
A reference to a global endpoint, which is used as a template to construct this endpoint. A template fixes the address (protocol, path, host, etc.), and may specify initial values for various properties, but further properties can be defined locally (as long as they do not change the address in any way). |
address |
string |
no |
|
The generic address for this endpoint. If this attribute is used, the protocol must be specified as part of the URI. Alternatively, most transports provide their own attributes for specifying the address (path, host, etc.). Note that the address attribute cannot be combined with 'ref' or with the transport-provided alternative attributes. |
responseTimeout |
integer |
no |
|
The timeout for a response if making a synchronous endpoint call |
encoding |
string |
no |
|
String encoding used for messages. |
connector-ref |
string |
no |
|
The name of the connector associated with this endpoint. This must be specified if more than one connector is defined for this transport. |
transformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the message before it is delivered to the component. |
responseTransformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the synchronous response before it is returned via the transport. |
disableTransportTransformer |
boolean |
no |
|
Don't use the default inbound/outbound/response transformer which corresponds to this endpoint's transport, if any. |
mimeType |
string |
no |
|
The mime type, e.g. text/plain or application/json |
exchange-pattern |
one-way/request-response |
no |
|
|
path |
string |
no |
|
The queue path, such as dispatchInQueue to create the address vm://dispatchInQueue. |
Child Elements of <inbound-endpoint...>
Name |
Cardinality |
Description |
|---|---|---|
response |
0..1 |
|
abstract-transaction |
0..1 |
A placeholder for transaction elements. Transactions allow a series of operations to be grouped together. |
abstract-xa-transaction |
0..1 |
A placeholder for XA transaction elements. XA transactions allow a series of operations to be grouped together spanning different transports, such as JMS and JDBC. |
abstract-transformer |
0..1 |
A placeholder for transformer elements. Transformers convert message payloads. |
abstract-filter |
0..1 |
A placeholder for filter elements, which control which messages are handled. |
abstract-security-filter |
0..1 |
A placeholder for security filter elements, which control access to the system. |
abstract-intercepting-message-processor |
0..1 |
A placeholder for intercepting router elements. |
abstract-observer-message-processor |
0..1 |
A placeholder for message processors that observe the message but do not mutate it used for exmaple for logging. |
processor |
0..1 |
A reference to a message processor defined elsewhere. |
custom-processor |
0..1 |
|
property |
0..* |
Sets a Mule property. This is a name/value pair that can be set on components, services, etc., and which provide a generic way of configuring the system. Typically, you shouldn't need to use a generic property like this, since almost all functionality is exposed via dedicated elements. However, it can be useful in configuring obscure or overlooked options and in configuring transports from the generic endpoint elements. |
properties |
0..1 |
A map of Mule properties. |
Outbound endpoint
The endpoint to which this connector sends messages.
Attributes of <outbound-endpoint...>
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
name |
name (no spaces) |
no |
|
Identifies the endpoint in the registry. There is not need to set the 'name' attribute on inbound or outbound endpoints, only on global endpoints. |
name |
name (no spaces) |
no |
|
Identifies the endpoint in the registry. There is not need to set the 'name' attribute on inbound or outbound endpoints, only on global endpoints. |
exchange-pattern |
one-way/request-response |
no |
|
|
ref |
string |
no |
|
A reference to a global endpoint, which is used as a template to construct this endpoint. A template fixes the address (protocol, path, host, etc.), and may specify initial values for various properties, but further properties can be defined locally (as long as they do not change the address in any way). |
address |
string |
no |
|
The generic address for this endpoint. If this attribute is used, the protocol must be specified as part of the URI. Alternatively, most transports provide their own attributes for specifying the address (path, host, etc.). Note that the address attribute cannot be combined with 'ref' or with the transport-provided alternative attributes. |
responseTimeout |
integer |
no |
|
The timeout for a response if making a synchronous endpoint call |
encoding |
string |
no |
|
String encoding used for messages. |
connector-ref |
string |
no |
|
The name of the connector associated with this endpoint. This must be specified if more than one connector is defined for this transport. |
transformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the message before it is delivered to the component. |
responseTransformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the synchronous response before it is returned via the transport. |
disableTransportTransformer |
boolean |
no |
|
Don't use the default inbound/outbound/response transformer which corresponds to this endpoint's transport, if any. |
mimeType |
string |
no |
|
The mime type, e.g. text/plain or application/json |
path |
string |
no |
|
The queue path, such as dispatchInQueue to create the address vm://dispatchInQueue. |
Child Elements of <outbound-endpoint...>
Name |
Cardinality |
Description |
|---|---|---|
response |
0..1 |
|
abstract-transaction |
0..1 |
A placeholder for transaction elements. Transactions allow a series of operations to be grouped together. |
abstract-xa-transaction |
0..1 |
A placeholder for XA transaction elements. XA transactions allow a series of operations to be grouped together spanning different transports, such as JMS and JDBC. |
abstract-transformer |
0..1 |
A placeholder for transformer elements. Transformers convert message payloads. |
abstract-filter |
0..1 |
A placeholder for filter elements, which control which messages are handled. |
abstract-security-filter |
0..1 |
A placeholder for security filter elements, which control access to the system. |
abstract-intercepting-message-processor |
0..1 |
A placeholder for intercepting router elements. |
abstract-observer-message-processor |
0..1 |
A placeholder for message processors that observe the message but do not mutate it used for exmaple for logging. |
processor |
0..1 |
A reference to a message processor defined elsewhere. |
custom-processor |
0..1 |
|
property |
0..* |
Sets a Mule property. This is a name/value pair that can be set on components, services, etc., and which provide a generic way of configuring the system. Typically, you shouldn't need to use a generic property like this, since almost all functionality is exposed via dedicated elements. However, it can be useful in configuring obscure or overlooked options and in configuring transports from the generic endpoint elements. |
properties |
0..1 |
A map of Mule properties. |
Endpoint
An endpoint "template" that can be used to construct an inbound or outbound endpoint elsewhere in the configuration by referencing the endpoint name.
Attributes of <endpoint...>
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
name |
name (no spaces) |
yes |
|
Identifies the endpoint so that other elements can reference it. This name can also be referenced in the MuleClient. |
name |
name (no spaces) |
yes |
|
Identifies the endpoint so that other elements can reference it. This name can also be referenced in the MuleClient. |
ref |
string |
no |
|
A reference to a global endpoint, which is used as a template to construct this endpoint. A template fixes the address (protocol, path, host, etc.), and may specify initial values for various properties, but further properties can be defined locally (as long as they do not change the address in any way). |
address |
string |
no |
|
The generic address for this endpoint. If this attribute is used, the protocol must be specified as part of the URI. Alternatively, most transports provide their own attributes for specifying the address (path, host, etc.). Note that the address attribute cannot be combined with 'ref' or with the transport-provided alternative attributes. |
responseTimeout |
integer |
no |
|
The timeout for a response if making a synchronous endpoint call |
encoding |
string |
no |
|
String encoding used for messages. |
connector-ref |
string |
no |
|
The name of the connector associated with this endpoint. This must be specified if more than one connector is defined for this transport. |
transformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the message before it is delivered to the component. |
responseTransformer-refs |
list of names |
no |
|
A list of the transformers that will be applied (in order) to the synchronous response before it is returned via the transport. |
disableTransportTransformer |
boolean |
no |
|
Don't use the default inbound/outbound/response transformer which corresponds to this endpoint's transport, if any. |
mimeType |
string |
no |
|
The mime type, e.g. text/plain or application/json |
exchange-pattern |
one-way/request-response |
no |
|
|
path |
string |
no |
|
The queue path, such as dispatchInQueue to create the address vm://dispatchInQueue. |
Child Elements of <endpoint...>
Name |
Cardinality |
Description |
|---|---|---|
response |
0..1 |
|
abstract-transaction |
0..1 |
A placeholder for transaction elements. Transactions allow a series of operations to be grouped together. |
abstract-xa-transaction |
0..1 |
A placeholder for XA transaction elements. XA transactions allow a series of operations to be grouped together spanning different transports, such as JMS and JDBC. |
abstract-transformer |
0..1 |
A placeholder for transformer elements. Transformers convert message payloads. |
abstract-filter |
0..1 |
A placeholder for filter elements, which control which messages are handled. |
abstract-security-filter |
0..1 |
A placeholder for security filter elements, which control access to the system. |
abstract-intercepting-message-processor |
0..1 |
A placeholder for intercepting router elements. |
abstract-observer-message-processor |
0..1 |
A placeholder for message processors that observe the message but do not mutate it used for exmaple for logging. |
processor |
0..1 |
A reference to a message processor defined elsewhere. |
custom-processor |
0..1 |
|
property |
0..* |
Sets a Mule property. This is a name/value pair that can be set on components, services, etc., and which provide a generic way of configuring the system. Typically, you shouldn't need to use a generic property like this, since almost all functionality is exposed via dedicated elements. However, it can be useful in configuring obscure or overlooked options and in configuring transports from the generic endpoint elements. |
properties |
0..1 |
A map of Mule properties. |
Transaction
The transaction element configures a transaction. Transactions allow a series of operations to be grouped together so that they can be rolled back if a failure occurs. For more information, see Transaction Management.
Child Elements of <transaction...>
Name |
Cardinality |
Description |
|---|
Schema
-
5 global elements, 2 local elements, 4 complexTypes, 1 attribute group
| Schema Summary | ||
| The VM transport is used for intra-VM communication between components managed by Mule. Target Namespace: Defined Components:
Default Namespace-Qualified Form:
Schema Location:
Imports Schemas (3): Imported by Schema:
|
||
| All Element Summary | ||||||||||||
| connector |
|
|||||||||||
| endpoint | An endpoint "template" that can be used to construct an inbound or outbound endpoint elsewhere in the configuration by referencing the endpoint name.
|
|||||||||||
| inbound-endpoint | The endpoint on which this connector receives messages from the transport.
|
|||||||||||
| outbound-endpoint | The endpoint to which this connector sends messages.
|
|||||||||||
| queue-profile | Configures the properties of this connector's queue (see [Configuring Queues]).
|
|||||||||||
| queueProfile | DEPRECATED.
|
|||||||||||
| transaction | The transaction element configures a transaction.
|
|||||||||||
| Complex Type Summary | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
| Attribute Group Summary | ||||||||||
|
||||||||||
| XML schema documentation generated with DocFlex/XML RE 1.8.5 using DocFlex/XML XSDDoc 2.5.0 template set. All content model diagrams generated by Altova XMLSpy via DocFlex/XML XMLSpy Integration. |
Javadoc API Reference
The Javadoc for this module can be found here:
VMMaven
The In Memory Transport can be included with the following dependency:
Best Practices
Be certain that inbound request-response endpoints are paired with outbound request-response endpoints and inbound one-way endpoints are paired with outbound one-way endpoints.