SlideShare a Scribd company logo
1 of 12
Java Components in Mule
By,
Harish
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

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>
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>
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:
– Custom Interceptor
– Logging Interceptor
– 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
help 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
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.
THANK YOU!!

More Related Content

What's hot

Mocking with salesforce using Munit
Mocking with salesforce using MunitMocking with salesforce using Munit
Mocking with salesforce using MunitSon Nguyen
 
Android - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskAndroid - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskHoang Ngo
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3DHIRAJ PRAVIN
 
What Is JMeter?
What Is JMeter?What Is JMeter?
What Is JMeter?QATestLab
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future TaskSomenath Mukhopadhyay
 
Basic of jMeter
Basic of jMeter Basic of jMeter
Basic of jMeter Shub
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design PatternShahriar Hyder
 
Java 8 - Completable Future
Java 8 - Completable FutureJava 8 - Completable Future
Java 8 - Completable FutureSajad jafari
 
Design patterns - Singleton&Command
Design patterns - Singleton&CommandDesign patterns - Singleton&Command
Design patterns - Singleton&CommandKai Aras
 
Implementing Generic Servers for Eclipse WebTools
Implementing Generic Servers for Eclipse WebToolsImplementing Generic Servers for Eclipse WebTools
Implementing Generic Servers for Eclipse WebToolsGorkem Ercan
 
Qt test framework
Qt test frameworkQt test framework
Qt test frameworkICS
 
JMeter - Performance testing your webapp
JMeter - Performance testing your webappJMeter - Performance testing your webapp
JMeter - Performance testing your webappAmit Solanki
 
Apache JMeter - A Brief Introduction
Apache JMeter - A Brief IntroductionApache JMeter - A Brief Introduction
Apache JMeter - A Brief Introductionagilitator
 
Java ppts unit1
Java ppts unit1Java ppts unit1
Java ppts unit1Priya11Tcs
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmetertest test
 

What's hot (20)

Mocking with salesforce using Munit
Mocking with salesforce using MunitMocking with salesforce using Munit
Mocking with salesforce using Munit
 
Android - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskAndroid - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTask
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3
 
What Is JMeter?
What Is JMeter?What Is JMeter?
What Is JMeter?
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future Task
 
Basic of jMeter
Basic of jMeter Basic of jMeter
Basic of jMeter
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
React hooks
React hooksReact hooks
React hooks
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Java 8 - Completable Future
Java 8 - Completable FutureJava 8 - Completable Future
Java 8 - Completable Future
 
Design patterns - Singleton&Command
Design patterns - Singleton&CommandDesign patterns - Singleton&Command
Design patterns - Singleton&Command
 
Implementing Generic Servers for Eclipse WebTools
Implementing Generic Servers for Eclipse WebToolsImplementing Generic Servers for Eclipse WebTools
Implementing Generic Servers for Eclipse WebTools
 
Qt test framework
Qt test frameworkQt test framework
Qt test framework
 
JMeter - Performance testing your webapp
JMeter - Performance testing your webappJMeter - Performance testing your webapp
JMeter - Performance testing your webapp
 
Apache JMeter - A Brief Introduction
Apache JMeter - A Brief IntroductionApache JMeter - A Brief Introduction
Apache JMeter - A Brief Introduction
 
React hooks
React hooksReact hooks
React hooks
 
Java ppts unit1
Java ppts unit1Java ppts unit1
Java ppts unit1
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmeter
 
J Meter Intro
J Meter IntroJ Meter Intro
J Meter Intro
 

Similar to Java components in mule

Java Components and their applicability in Mule Anypoint Studio
Java Components and their applicability in Mule Anypoint StudioJava Components and their applicability in Mule Anypoint Studio
Java Components and their applicability in Mule Anypoint StudioVenkataNaveen Kumar
 
Java in mule part 1
Java in mule part 1Java in mule part 1
Java in mule part 1vasanthii9
 
Introduction to testing mule
Introduction to testing muleIntroduction to testing mule
Introduction to testing muleRamakrishna kapa
 
Introduction testingmule
Introduction testingmuleIntroduction testingmule
Introduction testingmuleSrikrishna k
 
Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management toolRenato Primavera
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
Testing mule
Testing   muleTesting   mule
Testing muleSindhu VL
 
Mule testing
Mule   testingMule   testing
Mule testingSindhu VL
 
Custom transformer and annotation
Custom transformer and annotationCustom transformer and annotation
Custom transformer and annotationSunil Kumar
 
Puppet At Twitter - Puppet Camp Silicon Valley
Puppet At Twitter - Puppet Camp Silicon ValleyPuppet At Twitter - Puppet Camp Silicon Valley
Puppet At Twitter - Puppet Camp Silicon ValleyPuppet
 
An Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAn Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAhmed Ehab AbdulAziz
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routerssathyaraj Anand
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JSIvano Malavolta
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentationAndrei Burian
 

Similar to Java components in mule (20)

Java Components and their applicability in Mule Anypoint Studio
Java Components and their applicability in Mule Anypoint StudioJava Components and their applicability in Mule Anypoint Studio
Java Components and their applicability in Mule Anypoint Studio
 
Java in mule part 1
Java in mule part 1Java in mule part 1
Java in mule part 1
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Introduction to testing mule
Introduction to testing muleIntroduction to testing mule
Introduction to testing mule
 
Introduction testingmule
Introduction testingmuleIntroduction testingmule
Introduction testingmule
 
Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Testing mule
Testing   muleTesting   mule
Testing mule
 
Mule testing
Mule   testingMule   testing
Mule testing
 
Custom transformer and annotation
Custom transformer and annotationCustom transformer and annotation
Custom transformer and annotation
 
Maven
MavenMaven
Maven
 
Puppet At Twitter - Puppet Camp Silicon Valley
Puppet At Twitter - Puppet Camp Silicon ValleyPuppet At Twitter - Puppet Camp Silicon Valley
Puppet At Twitter - Puppet Camp Silicon Valley
 
An Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAn Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDD
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentation
 
Maf3 - Part 1
Maf3 - Part 1Maf3 - Part 1
Maf3 - Part 1
 

More from Harish43

Rest service in mule
Rest service in mule Rest service in mule
Rest service in mule Harish43
 
Cache scope and strategy
Cache scope and strategy Cache scope and strategy
Cache scope and strategy Harish43
 
Mule management console installation steps
Mule management console installation stepsMule management console installation steps
Mule management console installation stepsHarish43
 
Queues and Mule Transport Mechanisms
Queues and Mule Transport MechanismsQueues and Mule Transport Mechanisms
Queues and Mule Transport MechanismsHarish43
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering conceptsHarish43
 
Batch processing
Batch processingBatch processing
Batch processingHarish43
 
Batch processing
Batch processingBatch processing
Batch processingHarish43
 

More from Harish43 (7)

Rest service in mule
Rest service in mule Rest service in mule
Rest service in mule
 
Cache scope and strategy
Cache scope and strategy Cache scope and strategy
Cache scope and strategy
 
Mule management console installation steps
Mule management console installation stepsMule management console installation steps
Mule management console installation steps
 
Queues and Mule Transport Mechanisms
Queues and Mule Transport MechanismsQueues and Mule Transport Mechanisms
Queues and Mule Transport Mechanisms
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering concepts
 
Batch processing
Batch processingBatch processing
Batch processing
 
Batch processing
Batch processingBatch processing
Batch processing
 

Recently uploaded

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 

Recently uploaded (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 

Java components in mule

  • 1. Java Components in Mule By, Harish
  • 2. 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
  • 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. 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>
  • 4. 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>
  • 5. 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: – Custom Interceptor – Logging Interceptor – Timer Interceptor
  • 6. 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 help 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>
  • 7. 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>
  • 8. 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>
  • 9. 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
  • 10. 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
  • 11. Component Life-cycle Interfaces:  A custom LifecycleAdaptor can be configured to customize the way in which the component implementation is initialized and disposed.