Appendix B. Component and transformer annotations quick reference

As introduced in section 6.1.4, Mule offers Java code-level annotations that can be used on components, transformers, and other classes loaded by Mule. These annotations cover a whole range of functionality. Table B.1 provides you with a quick reference for these annotations.

Table B.1. Annotations reference

Annotation

Description

Type

Module

@ContainsTransformer-Methods Signals that a class contains transformer methods. Method annotations
@Transformer Used to create a Mule transformer from a class method. Method annotations
@Schedule Schedules a method for execution using either a simple frequency or cron expression. Method quartz
@IntegrationBean A dependency injector annotation used to inject an iBean such as Facebook or Amazon S3 into your component. Field ibeans
@MockIntegrationBean Similar to the @IntegrationBean annotation, this one can be used in tests to create a mock instance of an iBean that’s good for testing the bean without actually making requests to the external service. Field ibeans
@Lookup Dependency injection annotation used to retrieve objects from the registry. Field, parameter annotations
@Payload A parameter injection annotation that can be used on component entry points and transformer methods defined using the @Transformer annotation, this annotation controls how the current message payload is passed into a method by performing automatic transformation of the message payload to match the annotated parameter type. Parameter annotations
@InboundHeaders Used on component entry points and transformer methods, this annotation controls how the current message inbound headers are passed into a method. The annotation supports Map, List, single headers, and wildcards. Parameter annotations
@OutboundHeaders Used on component entry points and transformer methods, this annotation controls how the current message outbound headers are passed into a method. Users can write to this Map to attach headers to the outgoing message. Parameter annotations
@InboundAttachments Used on component entry points and transformer methods, this annotation controls how the current message inbound attachments are passed into a method. The annotation supports Map, List, single headers, and wildcards. Parameter annotations
@OutboundAttachments Used on component entry points and transformer methods, this annotation controls how the current message outbound attachments are passed into a method. Users can write to this Map to attach attachments to the outgoing message. Parameter annotations
@Xpath This annotation can be used to execute an XPath expression on the message payload with the result being passed into the method. Parameter xml
@Groovy This annotation can be used to execute a Groovy expression on the message payload with the result being passed into the method. Parameter scripting
@Mule A parameter injection annotation that can be used on component entry points and transformer methods, this annotation can be used to execute a Mule expression. Parameter annotations
@Function A parameter injection annotation expression on the message payload with the result being passed into the method, this annotation exposes a common set of functions used in Mule such as a counter, UUID generator, date and timestamps, etc. Parameter annotations

Most annotations are provided in the mule-module-annotations module, but some come from other modules. Be sure to have the necessary modules on your classpath if you’re not deploying on Mule standalone.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset