<Spring: Beans> Create a spring bean and put the object created by mule in the registration information of mule.
<Spring: Beans>
<Spring: bean name = "globalcache" class = "com. mycompany. utils. lrucache">
<Spring: property name = "maxitems" value = "200"/>
</Spring: bean>
</Spring: Beans>
<Spring: Property> objects created by mule can be spring attribute objects.
<Custom-processor class = "com. mycompany. utils. customerclasschecker">
<Spring: property name = "highpriorities">
<Spring: List>
<Spring: value> gold </spring: value>
<Spring: value> platinum </spring: value>
<Spring: value> Executive </spring: value>
</Spring: List>
</Spring: Property>
</Custom-processor>
Mule can use spring attributes
<Spring: Beans>
<Context: Property-placeholder
Location = "classpath: my-mule-app.properties,
Classpath: my-mule-app-override.properties "/>
</Spring: Beans>
<Http: endpoint name = "protectedwebresource"
User = "$ {web. RSC. User }"
Password = "$ {web. RSC. Password }"
Host = "$ {web. RSC. Host }"
Port = "80"
Path = "path/to/resource"/>
Properties file:
Web. RSC. User = Alice
Web. RSC. Password = s3cr3t
Web. RSC. Host = www.acme.com
Connectors
Mule specific transmission object
Mule endpoint can specify connectors, so that the endpoint and connector are very flexible to separate
An endpoint can only have one connector.
If endctor mule is not specified for the endpoint, connector will be created for it.
<VM: Connector name = "persistentconne">
<VM: queueprofile persistent = "true"/>
</Vm: Connector>
<File: Connector name = "fileconnector"
Pollingfrequency = "1000" movetodirectory = "/tmp/test-data/out"/>
Endpoints
An object of mule can read or write information, and its attributes define how to process messages.
<VM: endpoint name = "in" address = "VM: // in" connector-ref = "persistentconnector"/>
<Http: endpoint name = "in" host = "localhost" Port = "8080" Path = "Services/orders"/>
<Endpoint name = "infiles" address = "file: // C:/orders"/>
Transformers
Convert current mule Information
<JSON: JSON-to-object-Transformer
Name = "jsontofruitcollection" returnclass = "org. mule. Module. JSON. Transformers. fruitcollection">
<JSON: deserialization-Mixin
Mixinclass = "org. mule. Module. JSON. Transformers. orangemixin" targetclass = "org. mule. TCK. testmodels. Fruit. Orange"/>
</JSON: JSON-to-object-transformer>
<Message-properties-transformer name = "setinvocationproperty" Scope = "invocation">
<Add-message-property key = "processed" value = "yes"/>
</Message-properties-transformer>
Filters
Whether the filter information is processed
<Wildcard-Filter pattern = "* Header received"/>
Only information matching the specified pattern is processed.
<Mxml: Is-XML-filter/>
Process only XML
<Message-filter onunaccepted = "deadletterqueue"> cancel
<Wildcard-Filter pattern = "* Header received"/>
</Message-filter>
<Message-filter throwonunaccepted = "true"> success
<Mxml: Is-XML-filter/>
</Message-filter>
Nested
<Or-filter>
<Wildcard-Filter pattern = "* Priority: 1 *"/>
<And-filter>
<Not-filter>
<Wildcard-Filter pattern = "* region: Canada *"/>
</Not-filter>
<Wildcard-Filter pattern = "* Priority: 2 *"/>
</And-filter>
</Or-filter>
Nested Conditions
Expressions
Mule expression, which can be used to determine or affect the behavior of a mule.
<Expression-filter evaluator = "Header" expression = "My-header! = NULL "/>
Use the expression value in the value # [Evaluator: expression]
<Message-properties-transformer>
<Add-message-property name = "guid" value = "# [String: # [XPath:/MSG/Header/ID]-# [XPath: /MSG/body/@ REF] "/>
</Message-properties-transformer>
Names and references
Used to specify global objects and reuse them.
VM: endpoint name = "in" address = "VM: // in" connector-ref = "persistentconne"/>
<Expression-Filter Name = checkmyheader "evaluator =" Header "expression =" My-header!
<Message-properties-transformer name = "setinvocationproperty" Scope = "invocation">
<Add-message-property key = "processed" value = "yes"/>
</Message-properties-transformer>
<Flow name = "usereferences">
<VM: Inbound-endpoint ref = "in"/>
<Filter ref = "checksetinvocationpropertymyheader"/>
<Transformer ref = ""/>
</Flow>
Flows
The most basic mule processing unit starts with an inbound endpoint followed by a series of processing and selectable outbound endpoint
<Flow name = "acceptandprocessorder">
<Http: Inbound-endpoint ref = "in"/> callback
<Byte-array-to-string-transformer/> bytes
<JDBC: Outbound-endpoint ref = "getordersbyid" exchange-pattern = "request-response"/> response
<Mxml: Object-to-XML-transformer/> Transform
<Expression-filter evaluator = "XPath" expression = "/status = 'ready'/> unlock
<Logger level = "debug" message = "fetched orders: # [payload]"/> revoke
<Splitter evaluator = "XPath" expression = "/order"/> merge
<Enricher> Enabled
<Authorize: Authorization-and-capture amount = "# [XPath:/amount]" volumes
CardNumber = "# [XPath:/card/number]"
Expdate = "# [XPath:/card/expire]"/>
<Enrich target = "# [variable: paymentsuccess]" Source = "# [Bean: responsecode]"/>
</Enricher>
<Message-properties-transformer scope =: Invocation "> reschedule
<Add-message-property key "user-email-address" value = "[XPath:/user/Email]"/>
</Message-properties-transformer>
<Component class = "org. mycompany. orderpreprocessor"/> commandid
<Flow-ref name = "processorder"/> procedure execution
<SMTP: Outbound-endpoint subject = "your order has been processed" to = "# [header: Invocation: User-email-address]/> too many
<Default-exception-strategy> zookeeper
<Processor-Chain> zookeeper
<Object-to-string-transformer/> upload success
<JMS: Outbound-endpoint ref = "Order-processing-errors"/> reschedule
</Processor-chain/>
</Default-exception-strategy>
</Flow>
Routers message routing Components
Mule information processor, which is implemented in Java by default and can be used in other languages
<Component class = "org. mycompany. orderpreprocessor"> example
<Entry-point-resolver-set>
<Method-entry-point-resolver>
<Include-entry-point method = "preprocessxmlorder"/>
<Include-entry-point method = "preprocesstextoorder"/>
</Method-entry-point-resolver>
<Reflection-entry-point-Resolver/>
</Entry-point-resolver-set>
</Component>
<Component class = "org. mycompany. orderpreprocessor"> example
<Property-entry-point-resolver property = "methodtocall"/>
</Component>
<Component class = "org. mycompany. generatedefaultorder"> extends
<No-arguments-entry-point-resolver>
<Include-entry-point method = "generate"/>
</No-arguments-entry-point-resolver>
</Component> cloud connectors
Call cloud services
Processor chain
Information processing chain
Sub-Flow
Call other flow
Bridge
Connect inbound endpoint and outbound endpoint
<Pattern: bridge name = "queue-to-topic" delimiter
Transacted = "true"
Inboundaddress = "JMS: // myqueue"
Outboundaddress = "JMS: // topic: mytopic"/>
<Pattern: bridge name = "transforming-bridge" Regular
Inboundaddress = "VM: // transforming-bridge.in"
Transformer-Refs = "Byte-array-to-string"
Responsetransformer-Refs = "string-to-byte-array"
Outboundaddress = "VM: // echo-service.in"/> simple service references services provided by other component <pattern: simple-service name = "echo-service" detail
Endpoint-ref = "echo-service-channel"
Component-class = "com. mycompany. echocomponent"/>
<Pattern: simple-service name = "Weather-forecaster-ws" Example
Address = "http: // localhost: 6099/weather-Forecast"
Component-class = "com. mympany. weatherforecaster"
Type = "Jax-ws"/> Web Service Proxy
Create a Web Service proxy <pattern: Web-service-proxy name = "Weather-forecast-WS-proxy"
Inboundaddress = "http: // localhost: 8090/weather-Forecast"
Outboundaddress = "http: // server1: 6090/weather-Forecast"
Wsdllocation = "http: // server1: 6090/weather-forecast? WSDL "/>