SlideShare a Scribd company logo
Java Components and their applicability in Mule Anypoint Studio
 The Java component enables the developer to package custom Java code
that executes when the component receives a message
 Mule provides two JavaComponent implementations:
 DefaultJavaComponent, which configured with the `component `element
<component class="org.my.CustomComponent"/>
 PooledJavaComponent, which adds pooling functionality when configured
with the pooled-component element.
<pooled-component class="org.my.CustomComponent"/>
 To configure the Java component, selecting a class is the only required
entry.
 The class name can be specified either through the “Class Name”
attribute or the “Object” attribute.
 Using the “Class Name” attribute is equivalent to using the prototype
object factory
J a v a C o m p o n e n t s i n M u l e .
 Object factories manage both object creation in case of Mule instantiated
instance or object look up from another container such as Spring.
 The following object factories are included with Mule and can be configured
using Mule’s core schema.
Type 1:<prototype-object class=…"/> :Creates a new instance of the object on
each call.
Example: <component class="org.my.CustomComponent"/>
or
<component ><prototype-object class="org.my.CustomComponent">
</component>
Type2:<singleton-object class=…"/> :Creates an instance of the object once and
then always returns the same instance .
Example:<component>
<singleton-object class="org.my.CustomComponent"/>
</component>
Type 3: <spring-object bean=…"/> :This is an implementation of the ObjectFactory
interface which simply delegates to the Spring ApplicationContext. Since the
delegation happens each time a call to getOrCreate() is made, this will correctly
handle Spring beans which are non-singletons (factory beans, etc.)
Example:
<component>
<spring-object bean="myCustomComponentBean"/>
</component>
Interceptors:
 Interceptors let us provide additional services to the component
Example: the ability to log transactions and the ability to log the time for each
transaction.
 An interceptor contains the business logic that is applied to the message payload
before being sent to the next building block.
 The following types of interceptors can be added to the Java component:
a)Custom Interceptor
b)Logging Interceptor
c)Timer Interceptor
Entry Point Resolvers:
 The entry point is the method in our component that is invoked by Mule
when a message is received.
 Entry point resolver determine how our component is invoked when a
message is received by the flow
 helps us to determine which method of a Java component will be called.
 Each entry point resolver is tried in turn until one succeeds in delivering the
message to the component.
Reflection Entry point resolver:
 Determines the message to be invoked based on number and type of
arguments.
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<reflection-entry-point-resolver/>
</component>
Entry Point Resolvers:
Property Entry point resolver:
 Uses a mule message property to select the component method to be called.
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<property-entry-point-resolver property="propertyName"/>
</component>
The property-entry-point-resolver lets you choose a method to invoke at run-
time by adding this property name to the MuleMessage.
Method entry point resolver:
 Delivers the message to a named method.
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<method-entry-point-resolver>
<include-entry-point method="methodString" />
</method-entry-point-resolver>
</component>
Entry Point Resolvers:
Custom Entry point resolver:
 Allows user-supplied code to determine how a message is passed to a
component in Java. .
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<custom-entry-point-resolver
class="org.mule.test.integration.resolvers.CustomEntryPointResolver"
/>
</component>
Callable Entry point resolver:
 An entry point resolver for the components that implement the Callable
interface.
 This passes a MuleEventContext to the component.
 This entry point resolver is implicitly configured only if the component
implements the Callable interface.
<component class="org.my.PrototypeObjectWithMyLifecycle">
<callable-entry-point-resolver/>
</component>
Entry Point Resolvers:
Array Entry point resolver:
 Delivers the message to a method that takes a single array as
argument.
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<array-entry-point-resolver/>
</component>
No Arguments Entry point resolver:
 Calls a method without any arguments.
<component class=”org.my.PrototypeObjectWithMyLifecycle”>
<no-arguments-entry-point-resolver/>
</component>
Include Entry point:
 Includes a particular method to be invoked.
Can be used in combination with any other entry point resolver when
there is ambiguity
Component Life-Cycle Interfaces
A custom LifecycleAdaptor can be configured to customize
the way in which the component implementation is initialized
and disposed

More Related Content

PPTX
Types of MessageRouting in Mule
PPTX
Mule: Java Component
PPTX
Mule: Java Transformer
PPTX
Mule Custom Aggregator
PPTX
Mule java part-1
PPTX
Mule esb usecase
PPTX
Message processor in mule
PPTX
Expression language
Types of MessageRouting in Mule
Mule: Java Component
Mule: Java Transformer
Mule Custom Aggregator
Mule java part-1
Mule esb usecase
Message processor in mule
Expression language

What's hot (20)

PPTX
Mule Message Chunk Aggregator
PPTX
Splitters in mule
PPTX
Mule java part-1
PPTX
Mule servlet connector
PPTX
PPTX
Mule concepts transformers
PPT
Mule overview
PPTX
Mule rabbit mq
PPTX
Mule Expression Transformer
PPTX
Mule UDP Transport
PPTX
Message structure
PPTX
Mule messages and transformers
PPTX
Controlling Message Flow - Mule ESB
PPTX
Mule expression component
PPTX
Mule LDAP Connector
PPTX
Rabbit Mq in Mule
PPTX
Mule JMS Transport
PPTX
Mule generic connector
PPT
Java Servlets
Mule Message Chunk Aggregator
Splitters in mule
Mule java part-1
Mule servlet connector
Mule concepts transformers
Mule overview
Mule rabbit mq
Mule Expression Transformer
Mule UDP Transport
Message structure
Mule messages and transformers
Controlling Message Flow - Mule ESB
Mule expression component
Mule LDAP Connector
Rabbit Mq in Mule
Mule JMS Transport
Mule generic connector
Java Servlets
Ad

Viewers also liked (12)

PPTX
Mule soft csv_toxml
PPTX
MuleSoft Anypoint Studio - Essentials - Data Filtering
PPTX
Thread Management In Mule
PDF
Java Week6(B) Notepad
PPTX
Input and output flow using http and java component
PDF
Java Swing Custom GUI MVC Component Tutorial
PPTX
Chapter 1 swings
PPT
java swing programming
PPT
Swing and AWT in java
PPT
java swing
PPTX
JAVA AWT
PPTX
Munit_in_mule_naveen
Mule soft csv_toxml
MuleSoft Anypoint Studio - Essentials - Data Filtering
Thread Management In Mule
Java Week6(B) Notepad
Input and output flow using http and java component
Java Swing Custom GUI MVC Component Tutorial
Chapter 1 swings
java swing programming
Swing and AWT in java
java swing
JAVA AWT
Munit_in_mule_naveen
Ad

Similar to Java Components and their applicability in Mule Anypoint Studio (20)

PPT
Java components in mule
PPT
Java components in Mule
PDF
Mule ESB
PPT
Mule web services
PPT
Mule and web services
PPTX
Mule esb
PPTX
Mule esb kranthi
PPTX
Esb process
PPTX
Mule esb kranthi
PPTX
Mule java part-3
PPTX
Mule slides
PPTX
PPTX
Sai mule esb batch
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule esb Basics
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule esb
Java components in mule
Java components in Mule
Mule ESB
Mule web services
Mule and web services
Mule esb
Mule esb kranthi
Esb process
Mule esb kranthi
Mule java part-3
Mule slides
Sai mule esb batch
Mule esb
Mule esb
Mule esb Basics
Mule esb
Mule esb
Mule esb
Mule esb

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Building Integrated photovoltaic BIPV_UPV.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction

Java Components and their applicability in Mule Anypoint Studio

  • 2.  The Java component enables the developer to package custom Java code that executes when the component receives a message  Mule provides two JavaComponent implementations:  DefaultJavaComponent, which configured with the `component `element <component class="org.my.CustomComponent"/>  PooledJavaComponent, which adds pooling functionality when configured with the pooled-component element. <pooled-component class="org.my.CustomComponent"/>  To configure the Java component, selecting a class is the only required entry.  The class name can be specified either through the “Class Name” attribute or the “Object” attribute.  Using the “Class Name” attribute is equivalent to using the prototype object factory J a v a C o m p o n e n t s i n M u l e .
  • 3.  Object factories manage both object creation in case of Mule instantiated instance or object look up from another container such as Spring.  The following object factories are included with Mule and can be configured using Mule’s core schema. Type 1:<prototype-object class=…"/> :Creates a new instance of the object on each call. Example: <component class="org.my.CustomComponent"/> or <component ><prototype-object class="org.my.CustomComponent"> </component> Type2:<singleton-object class=…"/> :Creates an instance of the object once and then always returns the same instance . Example:<component> <singleton-object class="org.my.CustomComponent"/> </component>
  • 4. Type 3: <spring-object bean=…"/> :This is an implementation of the ObjectFactory interface which simply delegates to the Spring ApplicationContext. Since the delegation happens each time a call to getOrCreate() is made, this will correctly handle Spring beans which are non-singletons (factory beans, etc.) Example: <component> <spring-object bean="myCustomComponentBean"/> </component> Interceptors:  Interceptors let us provide additional services to the component Example: the ability to log transactions and the ability to log the time for each transaction.  An interceptor contains the business logic that is applied to the message payload before being sent to the next building block.  The following types of interceptors can be added to the Java component: a)Custom Interceptor b)Logging Interceptor c)Timer Interceptor
  • 5. Entry Point Resolvers:  The entry point is the method in our component that is invoked by Mule when a message is received.  Entry point resolver determine how our component is invoked when a message is received by the flow  helps us to determine which method of a Java component will be called.  Each entry point resolver is tried in turn until one succeeds in delivering the message to the component. Reflection Entry point resolver:  Determines the message to be invoked based on number and type of arguments. <component class=”org.my.PrototypeObjectWithMyLifecycle”> <reflection-entry-point-resolver/> </component>
  • 6. Entry Point Resolvers: Property Entry point resolver:  Uses a mule message property to select the component method to be called. <component class=”org.my.PrototypeObjectWithMyLifecycle”> <property-entry-point-resolver property="propertyName"/> </component> The property-entry-point-resolver lets you choose a method to invoke at run- time by adding this property name to the MuleMessage. Method entry point resolver:  Delivers the message to a named method. <component class=”org.my.PrototypeObjectWithMyLifecycle”> <method-entry-point-resolver> <include-entry-point method="methodString" /> </method-entry-point-resolver> </component>
  • 7. Entry Point Resolvers: Custom Entry point resolver:  Allows user-supplied code to determine how a message is passed to a component in Java. . <component class=”org.my.PrototypeObjectWithMyLifecycle”> <custom-entry-point-resolver class="org.mule.test.integration.resolvers.CustomEntryPointResolver" /> </component> Callable Entry point resolver:  An entry point resolver for the components that implement the Callable interface.  This passes a MuleEventContext to the component.  This entry point resolver is implicitly configured only if the component implements the Callable interface. <component class="org.my.PrototypeObjectWithMyLifecycle"> <callable-entry-point-resolver/> </component>
  • 8. Entry Point Resolvers: Array Entry point resolver:  Delivers the message to a method that takes a single array as argument. <component class=”org.my.PrototypeObjectWithMyLifecycle”> <array-entry-point-resolver/> </component> No Arguments Entry point resolver:  Calls a method without any arguments. <component class=”org.my.PrototypeObjectWithMyLifecycle”> <no-arguments-entry-point-resolver/> </component> Include Entry point:  Includes a particular method to be invoked. Can be used in combination with any other entry point resolver when there is ambiguity
  • 9. Component Life-Cycle Interfaces A custom LifecycleAdaptor can be configured to customize the way in which the component implementation is initialized and disposed