The Mule 3.0 version provides a mechanism for "pattern". Pattern summarizes the common scenarios in the actual use process, provided in a simplified service configuration approach.
6.1 Simple Service pattern
The simple service mode is used to simplify the configuration of the synchronous service invocation, corresponding to the request-response mode in the message delivery mode.
Diagram Simple service mode
The simple service pattern is configured through the Simple-service element, and the main element attributes are:
Property |
Description |
Address |
The address of the service listener, such as Vm:in |
Component-class |
Implementation Class of Component |
Type |
Direct: default; JAX-WS: Exposes component as a SOAP-based Web service (component must be WS-Jax annotated), and address is generally HTTP Transport; Jax-rs: Exposing component as a RESTful Web service (component must be based on @path annotations), address is generally HTTP or servlet Transport |
code example:
<simple-service name= "Simple-service" address= "vm://simple.in" component-class= "Demo.mule.umo.Echo"/>
Mule can do additional processing for service request access, such as increasing the transformer configuration for data conversion.
6.2 Bridging Mode ( bridge pattern)
Bridging mode is used to establish a direct connection between inbound endpoint and outbound endpoint, without the need for component to provide business logic.
Tu Qiao Connection mode
Bridge mode is configured through bridge elements, and the main attributes are:
Property |
Description |
Inboundaddress |
Service Request Access Address |
Outboundaddress |
Actual address to be received by the service |
Exchange-pattern |
Request-response: Default, returns the processing result; One-way: One way |
Transacted |
True: Use transactions when distributing to outbound endpoint; False: Do not use transactions |
code example:
<bridge name= "Queue-to-topic" transacted= "true" inboundaddress= "Jms://myqueue" outboundaddress= " jms:// Topic:mytopic "/>
Mule can do additional processing during the connection, such as adding transformer configuration for data conversion. If transaction control is used, there is a need for a transaction controller that supports XA for transactions between heterogeneous protocols.
6.3 Checker Mode (validator pattern)
The validator mode filters the service request by defining a checksum filter and synchronously returns the ACK (acknowledge) or nack (not acknowledge) result. Service requests that are verified are distributed asynchronously to the processor.
Figure Validator Mode
The validator mode is configured through the validator element, and the main attributes are:
Property |
Description |
Inboundaddress |
Service Request Access Address |
Outboundaddress |
Service Pickup Address |
Ackexpression |
Expression used to build information when a service request is received |
Nackexpression |
Expression used to build information when a service request is denied |
Errorexpression |
@since 3.0.1 expression for building information when a service request distribution error occurs |
Validationfilter-ref |
Filter reference, or you can use child elements to specify whether a service request is received |
code example:
<validator name= "Integer-validator" inboundaddress= "vm://validator.in" ackexpression= "#[string:GOOD:#[ Message:payload]@#[context:servicename]] " nackexpression=" #[string:bad:#[message:payload]@#[context: ServiceName]] " outboundaddress=" vm://test-service.in "> <payload-type-filter expectedtype=" Java.lang.Integer "/> </validator>
Note: The expression of mule is supplemented later.
6.4 Web Services Proxy mode (Web service proxy pattern)
The Web services proxy pattern is used to forward Web service requests directly to the remote target Web service server, and mule itself does not provide an actual Web service.
Figure Web Service proxy mode
The Web service proxy pattern is configured through the Ws-proxy element, and the main attributes are:
Property |
Description |
Inboundaddress |
Mule Address provided externally |
Outboundaddress |
The actual address of the WEB service |
code example:
<ws:proxy name= "Ws-proxy" inboundaddress= "Http://localhost:7006/services/Echo" outboundaddress= "http ://localhost:8000/services/echo?method=echo "> </ws:proxy>
Mule can do additional processing during the forwarding process, such as increasing the transformer configuration for data conversion.