mule soft mel_session_3

9
Abhishek Jain

Upload: abhipokharna

Post on 14-Apr-2017

180 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Mule soft mel_session_3

Abhishek Jain

Page 2: Mule soft mel_session_3

List and Maps MEL Benefits Different Ways of using MEL Topic for next session Reference

Page 3: Mule soft mel_session_3

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

-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

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

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

Debugging in Anypoint Studio

Page 8: Mule soft mel_session_3

www.mulesoft.com Mule in Action

Page 9: Mule soft mel_session_3