7

Click here to load reader

How to use message properties component

Embed Size (px)

Citation preview

Page 1: How to use message properties component

How to use Message Properties component

Page 2: How to use message properties component

Abstract

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

Page 3: How to use message properties component

Example

Page 4: How to use message properties component

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

Page 5: How to use message properties component

• 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

Page 6: How to use message properties component

• 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