SlideShare a Scribd company logo
Java Components in Mule

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
Java Components in Mule

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.
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>
Java Components in Mule
2)<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>
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>
Java Components in Mule
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
Java Components in Mule
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>
Java Components in Mule
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>
Java Components in Mule
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>
Java Components in Mule
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
Java Components in Mule
Component Life-cycle
Interfaces:
A custom LifecycleAdaptor can be configured to customize
the way in which the component implementation is initialized
and disposed.
THANK YOU!!
Ad

Recommended

Java components in mule
Java components in mule
Harish43
 
Types of MessageRouting in Mule
Types of MessageRouting in Mule
VenkataNaveen Kumar
 
Java mule
Java mule
Gandham38
 
Spring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
Sam Brannen
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
Sam Brannen
 
Invoke component
Invoke component
Srilatha Kante
 
Java component
Java component
Srilatha Kante
 
Java concurrency
Java concurrency
Abhijit Gaikwad
 
Servlet
Servlet
Rami Nayan
 
Java Servlets
Java Servlets
Nitin Pai
 
JDBC
JDBC
Manjunatha RK
 
Custom transformer and annotation
Custom transformer and annotation
Sunil Kumar
 
J2EE-assignment
J2EE-assignment
gaurav sardhara
 
Javax.servlet,http packages
Javax.servlet,http packages
vamsi krishna
 
Java server pages
Java server pages
Tanmoy Barman
 
Jsp Introduction Tutorial
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 
Different Types of Containers in Spring
Different Types of Containers in Spring
Sunil kumar Mohanty
 
Command pattern in java
Command pattern in java
RakibAhmed0
 
Mule java part-4
Mule java part-4
Ravinder Singh
 
Java Servlets & JSP
Java Servlets & JSP
Manjunatha RK
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Types of Dependency Injection in Spring
Types of Dependency Injection in Spring
Sunil kumar Mohanty
 
Struts,Jsp,Servlet
Struts,Jsp,Servlet
dasguptahirak
 
Jsp ppt
Jsp ppt
Vikas Jagtap
 
Java servlets
Java servlets
lopjuan
 
1 java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Servlet api &amp; servlet http package
Servlet api &amp; servlet http package
renukarenuka9
 
JDBC in Servlets
JDBC in Servlets
Eleonora Ciceri
 
Caching a simple way
Caching a simple way
Anirban Sen Chowdhary
 
Handle exceptions in mule
Handle exceptions in mule
Son Nguyen
 

More Related Content

What's hot (20)

Servlet
Servlet
Rami Nayan
 
Java Servlets
Java Servlets
Nitin Pai
 
JDBC
JDBC
Manjunatha RK
 
Custom transformer and annotation
Custom transformer and annotation
Sunil Kumar
 
J2EE-assignment
J2EE-assignment
gaurav sardhara
 
Javax.servlet,http packages
Javax.servlet,http packages
vamsi krishna
 
Java server pages
Java server pages
Tanmoy Barman
 
Jsp Introduction Tutorial
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 
Different Types of Containers in Spring
Different Types of Containers in Spring
Sunil kumar Mohanty
 
Command pattern in java
Command pattern in java
RakibAhmed0
 
Mule java part-4
Mule java part-4
Ravinder Singh
 
Java Servlets & JSP
Java Servlets & JSP
Manjunatha RK
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Types of Dependency Injection in Spring
Types of Dependency Injection in Spring
Sunil kumar Mohanty
 
Struts,Jsp,Servlet
Struts,Jsp,Servlet
dasguptahirak
 
Jsp ppt
Jsp ppt
Vikas Jagtap
 
Java servlets
Java servlets
lopjuan
 
1 java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Servlet api &amp; servlet http package
Servlet api &amp; servlet http package
renukarenuka9
 
JDBC in Servlets
JDBC in Servlets
Eleonora Ciceri
 
Java Servlets
Java Servlets
Nitin Pai
 
Custom transformer and annotation
Custom transformer and annotation
Sunil Kumar
 
Javax.servlet,http packages
Javax.servlet,http packages
vamsi krishna
 
Different Types of Containers in Spring
Different Types of Containers in Spring
Sunil kumar Mohanty
 
Command pattern in java
Command pattern in java
RakibAhmed0
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Types of Dependency Injection in Spring
Types of Dependency Injection in Spring
Sunil kumar Mohanty
 
Java servlets
Java servlets
lopjuan
 
1 java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Servlet api &amp; servlet http package
Servlet api &amp; servlet http package
renukarenuka9
 

Viewers also liked (13)

Caching a simple way
Caching a simple way
Anirban Sen Chowdhary
 
Handle exceptions in mule
Handle exceptions in mule
Son Nguyen
 
Mule expression component
Mule expression component
Karnam Karthik
 
Message processor in mule
Message processor in mule
Son Nguyen
 
Message enricher in mule
Message enricher in mule
Sashidhar Rao GDS
 
Using groovy in mule
Using groovy in mule
Son Nguyen
 
Getting anypoint studios all versions
Getting anypoint studios all versions
Anirban Sen Chowdhary
 
Mule ESB
Mule ESB
Yura Nosenko
 
Mule esb examples
Mule esb examples
Sashidhar Rao GDS
 
Mule message enricher
Mule message enricher
Anirban Sen Chowdhary
 
Mule : Building Blocks for Microservices
Mule : Building Blocks for Microservices
Anirudh Pandit
 
Simple groovy example in mule
Simple groovy example in mule
Anirban Sen Chowdhary
 
Mule ESB Tutorial Part 1
Mule ESB Tutorial Part 1
Srikanth N
 
Ad

Similar to Java components in Mule (20)

Java Components and their applicability in Mule Anypoint Studio
Java Components and their applicability in Mule Anypoint Studio
VenkataNaveen Kumar
 
Mule: Java Component
Mule: Java Component
Sulthony Hartanto
 
Simple Java component in Mule
Simple Java component in Mule
Christian Hipolito
 
Mule java part-3
Mule java part-3
Karnam Karthik
 
Mule java part-1
Mule java part-1
Karnam Karthik
 
Mule java part-1
Mule java part-1
Ravinder Singh
 
Java in mule part 1
Java in mule part 1
vasanthii9
 
Mule java part-1
Mule java part-1
Karnam Karthik
 
Sai mule esb batch
Sai mule esb batch
saikiran6423
 
Mule slides
Mule slides
naveenkodumuri12
 
Mule
Mule
saikiran6423
 
Esb process
Esb process
saikiran6423
 
Mule esb kranthi
Mule esb kranthi
Earnest Stephen
 
Mule esb
Mule esb
saikiran6423
 
Mule esb kranthi
Mule esb kranthi
kranthikumar1210
 
Mule java part-3
Mule java part-3
Ravinder Singh
 
Mule esb
Mule esb
vishnukanthro45
 
Mule esb
Mule esb
charan teja R
 
Mule esb
Mule esb
Phaniu
 
Mule esb Basics
Mule esb Basics
Sunil Komarapu
 
Ad

Recently uploaded (20)

Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 

Java components in Mule

  • 1. Java Components in Mule  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
  • 2. Java Components in Mule  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. 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>
  • 3. Java Components in Mule 2)<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> 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>
  • 4. Java Components in Mule 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. Java Components in Mule 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. Java Components in Mule 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. Java Components in Mule 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. Java Components in Mule 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. Java Components in Mule Component Life-cycle Interfaces: A custom LifecycleAdaptor can be configured to customize the way in which the component implementation is initialized and disposed.