Mule soft mel_session_3
-
Upload
abhipokharna -
Category
Technology
-
view
180 -
download
0
Transcript of Mule soft mel_session_3
![Page 1: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/1.jpg)
Abhishek Jain
![Page 2: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/2.jpg)
List and Maps MEL Benefits Different Ways of using MEL Topic for next session Reference
![Page 3: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/3.jpg)
A Simple Map can be created using below MEL expression example:
[‘firstname’: ‘Abhi’, ‘lastname’:’jain’]
The above example will create a map having two properties (firstname, lastname) with the values as (Abhi, jain) respectively
On the same way arrays (Collection of Maps) can also be created[
[‘firstname’: ‘Abhi’, ‘lastname’:’jain’][‘firstname’: ‘Montu’, ‘lastname’:’jain’][‘firstname’: ‘John’, ‘lastname’:’ anderson’]
]
![Page 4: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/4.jpg)
-An Expression language which provides a consistent and standardized way to
developers
-Can be used easily with mule message, inbound/outbound properties, Variables
-Easy to use
-Works within message processors to decide the message routes
-Used for extracting the information
-No need to remember large syntaxes
-
![Page 5: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/5.jpg)
MEL expression can be used for extracting the data and then decide the next course of action i.e. these can be pretty much used inside choice routers for directing the messages to different routes
Small example:
<choice> <when expression="#[payload.getFlightName() == ‘Delta']">
<flow-ref name==“DeltaAirLinesProcess" /> </when> <when expression="#[payload.getFlightName() == ‘United’']">
<flow-ref name==“UnitedAirLinesProcess" /> </when>
</choice>
![Page 6: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/6.jpg)
MEL Can be used for extracting the values from payload, properties or context.
For example
You have several flow variables which are set (like to, cc, from, body) for sending email message.
You can extract all the info and set it while working with one processor
<smtp:outbound-endpoint from="#[flowVars.from]" to="#[flowVars.to]" subject="#[payload.subjectLine]" responseTimeout="10000" doc:name="SMTP"/>
![Page 7: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/7.jpg)
Debugging in Anypoint Studio
![Page 9: Mule soft mel_session_3](https://reader036.fdocuments.us/reader036/viewer/2022070601/58899be81a28ab330e8b73db/html5/thumbnails/9.jpg)