Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Integration Applications
with Anypoint Studio
• http://www.mulesoft.com/platform/soa/mule-esb-enterprise
Message Flow
Message Source
Message Processors
Mule Message
Message Source
Message Processors
Error Handling
Canvas
Package
Explorer
Palette
Console
17
17 l All contents Copyright © 2015, MuleSoft Inc.
Walkthrough 2-1: Create your first Mule application
• Components
- Execute specific logic upon a message, including
custom-logic in Java, JavaScript, Groovy, Python or
Ruby
- Logger component
• Transformers
- Convert data types and formats so as to "translate"
messages between applications or systems
- Set Payload transformer
• Scopes
- Wrap snippets of code to define fine-grained behavior
within a flow
• Filters
- Limit processing of messages based on set criteria
• Flow control
- Direct messages through different pathways in an
application depending upon content or other criteria
• Error handling
- Handle any errors that occur during message processing
Mule Message
• Outbound properties
- Added by message processor
Payload
- Read/write access
- Can set, remove, copy
Attachments
• Attachments
Payload
- Ancillary info to the message
- Similar to an email attachment
Attachments
Raw Data
Payload
<order>
• Raw data often of type
<id>ed921739-99c1-4e09</id> - String
<custId>49e377ed-bc72-4523</custId>
<itemsTotal>200.34</itemsTotal> - InputStream
</order> - Byte[] (Byte array)
org.java.lang.String
40 40
40 l All contents Copyright © 2015, MuleSoft Inc.
Inbound message properties
Mule Message
Inbound properties Content-Type = text/html
Inbound Method
Properties
= POST
Host = mulesoft.org
HTTP Request
<order>
Data <id>ed921739-99c1-4e09</id>
<order> Payload
<custId>49e377ed-bc72-4523</custId>
<id>ed921739-99c1-4e09</id> <itemsTotal>200.34</itemsTotal>
<custId>49e377ed-bc72-4523</custId> …
<itemsTotal>200.34</itemsTotal>
…
Attachments
Mule Message
Inbound Properties
HTTP Request
Content-Type = text/html
Method = POST Headers
Host = mulesoft.org Content-Type = text/html
Method = POST
Host = mulesoft.org
<order>
<id>ed921739-99c1-4e09</id>
<custId>49e377ed-bc72-4523</custId>
<itemsTotal>200.34</itemsTotal>
Data
… Payload <order>
<id>ed921739-99c1-4e09</id>
<custId>49e377ed-bc72-4523</custId>
<itemsTotal>200.34</itemsTotal>
…
Attachments
#[message.payload]
Dot notation to access fields or methods
46 l All contents Copyright © 2015, MuleSoft Inc.
Context objects
application
User application the current flow
is deployed in
message
The Mule message that the message
processer is processing
Outbound Properties
Content-Type = text/html
#[message.inboundProperties['http
Method = POST
Host = mulesoft.org
.method’]]
Payload POST
id: ed921739-99c1-4e09
custId: 49e377ed-bc72-4523 #[message.outboundProperties['con
itemsTotal: 200.34 tent-type’]]
java.util.HashMap
Attachments
[null]
#[payload.id]
Attachments
[null] Is a shortcut for #[message.payload]
This shortcut only works with payload
49 l All contents Copyright49
© 2015, MuleSoft Inc.
Accessing relational map data
#[message.payload[1]['LastName']]
Dailer
#[message.payload[0].City]
Boston
• Operators
- Arithmetic: +, -, /, *, %
- Evaluation: ==, !=, >, <, >=, <=, contains, is
#[message.inboundProperties.'http.query.params'.lastname != null]
• Data extraction
- XPath: #[xpath('expression')]
- RegEx: #[regex('expression')]
51 l All contents Copyright © 2015, MuleSoft Inc.
Walkthrough 2-3: Read and write message properties
flowVars
sessionVar
srecordVars
#[flowVars.ticketNum]
55 l All contents Copyright © 2015, MuleSoft Inc.
Setting variables
Flow
Inbound Scope
Outbound Scope