Property Transformer in Mule | Read Key-Value Pair in Mule
Use a property transformer to set, remove, or copy properties on the outbound scope of a message. This transformer transforms only outbound properties. Note that you cannot manipulate inbound scope properties, as those are automatically generated by the message source.
Property Transformer is used to store key-value pair in Mule.
flow of Property Transformer :
Property Transformer configuration :
URL : http://localhost:8085/api/property
Method : GET
Output :
XML project code :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:context="http://www.springframework.org/schema/context" 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.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/>
<context:property-placeholder location="credentials.properties"/>
<flow name="test_propertytransformerFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/property" doc:name="HTTP"/>
<set-property propertyName="name" value="Himanshu" doc:name="Property"/>
<set-payload value="#[message.outboundProperties.name]" doc:name="Set Payload"/>
</flow>
</mule>
Thanks for sharing valuable information and very well explained. Keep posting.
ReplyDeleteonline mulesoft training
mulesoft online course