vm transport

10
VM TRANSPORT VM Transport is based on in-memory Queues available within Mule JVM. These can also be persisted to Files should we require more reliable storage. These are just like JMS Queues

Upload: ramakrishna-kapa

Post on 14-Jan-2017

115 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Vm transport

VM TRANSPORTVM Transport is based on in-memory Queues available within Mule JVM. These can also be persisted to Files should we require more reliable storage. These are just like JMS Queues

Page 2: Vm transport

• The in memory (VM) transport has two modes of operation: One for use with request-response and another for use with one-way endpoints. 

• 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.

• one-way:• When using one-way endpoints, messages are delivered

to the corresponding inbound endpoint via a queue. This delivery is non-blocking.

Page 3: Vm transport

• Asynchronous communication is desired but external message broker (such as Active MQ) can’t be used. This can be for for performance or non-availability reasons.

• 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 or

address.

Page 4: Vm transport

Lets create an example to understand how VM transport works.

• Create a HTTP inbound endpoint with port as “8081” and path as “vm”. Then drag and drop a VM endpoint next to HTTP. Select “request-response” as exchange pattern. Also, specify “VM1” as Queue Path.

• Drag and drop another VM endpoint below vmdemoFlow1. Mule Studio automatically creates another flow named vmFlow2. Select “request-response” as exchange pattern. Also, specify “VM1” as Queue Path. This ensures messages passed from vmFlow1 are read in vmdemoFlow1 since Queue paths are same.

Page 5: Vm transport

vmdemoflow

Page 6: Vm transport

Http configuration

Page 7: Vm transport

Set Payload configuration

Page 8: Vm transport

XML code• <?xml version="1.0" encoding="UTF-8"?>

• <mule xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"

• xmlns:spring="http://www.springframework.org/schema/beans" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"• xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-

beans-current.xsd• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd• http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd">• <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener

Configuration"/>• <flow name="vmdemoFlow">• <http:listener config-ref="HTTP_Listener_Configuration" path="vm" doc:name="HTTP"/>• <set-payload value="Hello" doc:name="Set Payload"/>• <vm:outbound-endpoint exchange-pattern="request-response" path="VM1" doc:name="VM"/>• </flow>• <flow name="vmdemoFlow1">• <vm:inbound-endpoint exchange-pattern="request-response" path="VM1" doc:name="VM"/>• <set-payload value="#[message.payload]......MULE" doc:name="Set Payload"/>• <logger message="#[message.payload]" level="INFO" doc:name="Logger"/>• </flow>• </mule>

Page 9: Vm transport

Output:Using the url http://localhost:8081/vm

Page 10: Vm transport

Http://localhost:8081/vm• If it is a one-way communication• We can get the following output“Hello” only