Note: These screenshots are my way of trying to remember stuff from the 'Mule 3 in Depth' Udemy course. Also hopefully re-using some of this how-to knowledge in real-world stuff.
We need the following Mule Components in our Anytime Studio Mule Application:
HTTP
Set Payload
Java Component
Append String
Image: Anytime Studio: Mule Components Required
HTTP Component is configured as thus:
Path = /getprice
Image: HTTP Component configuration
Java Component is configured as thus:
Class Name = {Your Class}
Image: Java Component configuration
This example lab uses a Java Class that is already in Anypoint Studio (from the udemy course). The Java Class is as the image below.
Image: The Java Class
The Set Payload is configured as thus (we have this because the Java component expects string):
Value = #[message.inboundProperties.'http.query.params'.stock]
Image: Configuring Set Payload
The Append String component is configured as thus (because we want to put USD 'US Dollars' on the end of the Java output):
Message = USD
Image: Configuring Append String
Finally, if we run the Mule Application and go to the web page /getprice?stock={mule/ibm/...} this is what we get.
Image: Running the Mule Application
We need the following Mule Components in our Anytime Studio Mule Application:
HTTP
Set Payload
Java Component
Append String
Image: Anytime Studio: Mule Components Required
HTTP Component is configured as thus:
Path = /getprice
Image: HTTP Component configuration
Java Component is configured as thus:
Class Name = {Your Class}
Image: Java Component configuration
This example lab uses a Java Class that is already in Anypoint Studio (from the udemy course). The Java Class is as the image below.
Image: The Java Class
The Set Payload is configured as thus (we have this because the Java component expects string):
Value = #[message.inboundProperties.'http.query.params'.stock]
Image: Configuring Set Payload
The Append String component is configured as thus (because we want to put USD 'US Dollars' on the end of the Java output):
Message = USD
Image: Configuring Append String
Finally, if we run the Mule Application and go to the web page /getprice?stock={mule/ibm/...} this is what we get.
Image: Running the Mule Application
Comments
Post a Comment