message properties component

7
Message Properties Component In Mule Demo

Upload: sunil-komarapu

Post on 08-Feb-2017

123 views

Category:

Technology


1 download

TRANSCRIPT

Message Properties Component In Mule Demo

Abstract

• The main motto of this PPT is how to use Message Properties in our applications.

Example

• .mflow• <?xml version="1.0" encoding="UTF-8"?>

• <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" 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" version="EE-3.4.0" 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/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">• <flow name="MessagePropertiesFlow1" doc:name="MessagePropertiesFlow1">• <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" path="messageproperties"

doc:name="HTTP"/>• <message-properties-transformer scope="session" doc:name="Message Properties">• <add-message-property key="property1" value="studio"/>• </message-properties-transformer>• <message-properties-transformer scope="outbound" doc:name="Message Properties">• <add-message-property key="property2" value="mule"/>• </message-properties-transformer>• <logger message="--flow1--#[message.outboundProperties['property2']]--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/>• <vm:outbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/>• </flow>• <flow name="MessagePropertiesFlow2" doc:name="MessagePropertiesFlow2">• <vm:inbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/>• <logger message="---flow2--#[message.inboundProperties['property2']]--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/>• </flow>• </mule>

• Output:

• INFO 2015-10-03 16:00:23,705 [[messageproperties].config.change.14.thread.1] org.mule.DefaultMuleContext: • **********************************************************************• * Application: messageproperties *• * OS encoding: Cp1252, Mule encoding: UTF-8 *• * *• * Agents Running: *• * Clustering Agent *• * JMX Agent *• **********************************************************************• INFO 2015-10-03 16:00:23,706 [[messageproperties].config.change.14.thread.1]

org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++• + Started app 'messageproperties' +• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++• INFO 2015-10-03 16:00:26,480 [[messageproperties].connector.http.mule.default.receiver.02]

org.mule.api.processor.LoggerMessageProcessor: --flow1--mule--studio• INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02]

org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.771015974'. Object is: VMMessageDispatcher

• INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.771015974'. Object is: VMMessageDispatcher

• INFO 2015-10-03 16:00:26,489 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: ---flow2--mule--studio

• Flow of execution:1. URL to trigger the service from browser http://

localhost:8089/messageproperties2. In flow1 both outbound and session property is created using message property component3. Service displays both outbound and session properties in flow14. In flow2 the outbound property is changes to inbound proeprty5. Flow2 displays both inbound and session property