SlideShare a Scribd company logo
Maven Tools & Archetypes
• For a while now there have been maven archetypes for creating mule
apps and domains. Such archetypes make getting started with
development easier by automatically generating the basic core
structure and files of mule projects (think configuration files, test
classes, pom). This is especially interesting since the introduction in
3.5.0 of shared resources through mule domains which could make
your app depend on another external project (a domain) and using
Maven to manage dependencies makes perfect sense. We will see
how to use these archetypes to create a domain and an application
that uses it.
Creating a domain
• We’ll start by creating a domain where we’ll define an HTTP listener
to be shared.
• mvn archetype:generate -DarchetypeGroupId=org.mule.tools.maven -
DarchetypeArtifactId=maven-archetype-mule-domain -
DarchetypeVersion=1.1 -DgroupId=org.myfakecompany.domain -
DartifactId=my-mule-domain -Dversion=1.0-SNAPSHOT -
Dpackage=org.myfakecompany.domain
This will create a project named my-mule-domain
that contains a mule-domain-config.xml file where
we can define our listener config:<?xml version="1.0" encoding="UTF-8"?>
<domain:mule-domain
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:domain="http://www.mulesoft.org/schema/mule/domain"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/domain http://www.mulesoft.org/schema/mule/domain/current/mule-domain.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<!-- configure here resources to be shared within the domain -->
<http:listener-config host="localhost" port="8081" basePath="domain" name="listenerConfig"/>
</domain:mule-domain>
Creating an app
• Now we’ll create a project for an app that uses my-mule-domain. In this
case, we can indicate which transports and modules we’ll be starting with
and the mule version we’ll be using.
• mvn archetype:generate -DarchetypeGroupId=org.mule.tools.maven -
DarchetypeArtifactId=maven-archetype-mule-app -DarchetypeVersion=1.1
-DgroupId=org.myfakecompany.app -DartifactId=my-mule-app -
Dversion=1.0-SNAPSHOT -DmuleVersion=3.7.0 -
Dpackage=org.myfakecompany.app -Dtransports=http,vm -
Dmodules=db,xml,ws -DdomainGroupId=org.myfakecompany.domain -
DdomainArtifactId=my-mule-domain -DdomainVersion=1.0-SNAPSHOT
• This will create a project named my-mule-app that contains a mule
app configuration file already set up with the namespaces of the
transports and modules indicated, as well as the dependencies for
them set up in the project’s pom file. In there you’ll also find a mule-
deploy.properties file with the domain specified to my-mule-domain
and an ExampleFunctionalTestCase for our app.
Let’s modify the app to use the shared HTTP
listener and it’s test accordingly. We’ll get rid of
the vm endpoints and extra initial message
processors and add our listener:
<flow name="main">
<http:listener config-ref="listenerConfig" path="test"/>
<set-payload value="Received" />
</flow>
In ExampleFunctionalTestCase we can now use the
MuleClient to send a request to
“http://localhost:8081/domain/test”. Let’s replace
the vm related client code and modify the
expected payload since now we’ll be expecting
“Received”:
@Test
public void testConfiguration() throws Exception
{
MuleClient client = getMuleContextForApp("myApp").getClient();
MuleMessage message = new DefaultMuleMessage("some data", getMuleContextForApp("myApp"));
MuleMessage result = client.send("http://localhost:8081/domain/test", message);
assertNotNull(result);
assertNull(result.getExceptionPayload());
assertFalse(result.getPayload() instanceof NullPayload);
assertEquals("Received", result.getPayloadAsString());
}
• That’s it, we now have an application that’s using a listener defined in
a domain AND a test case for it. This works because the external
domain project is added as a dependency of our project, as well as a
Maven plugin to unpack it’s configuration file, all of which was set up
when we created the app through the archetype. Just compile
everything and run the test.
Extra
• Archetypes are not all there is to offer for Maven projects though.
Each of the projects mentioned above uses a special maven plugin to
manage the packaging into deployable .zip files.
• If I want to generate the deployable .zip for my domain I just have to
run: mvn package

More Related Content

What's hot

Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESB
Rupesh Sinha
 
Mule batch job
Mule batch jobMule batch job
Mule batch job
Anirban Sen Chowdhary
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
javeed_mhd
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mule
javeed_mhd
 
Mule testing
Mule   testingMule   testing
Mule testing
Sindhu VL
 
Mule
MuleMule
Mule
irfan1008
 
Mule maven
Mule mavenMule maven
Mule maven
JavierMarRas
 
Load balancer in mule
Load balancer in muleLoad balancer in mule
Load balancer in mule
Ramakrishna kapa
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mule
javeed_mhd
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
Khasim Saheb
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
Khasim Saheb
 
Testing mule
Testing   muleTesting   mule
Testing mule
Sindhu VL
 
Introduction testingmule
Introduction testingmuleIntroduction testingmule
Introduction testingmule
Srikrishna k
 
Mule velocity
Mule velocityMule velocity
Mule velocity
Praneethchampion
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
F K
 
Mule - logger
Mule -  loggerMule -  logger
Mule - logger
Ankush Sharma
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
Anirban Sen Chowdhary
 
Mule esb usecase
Mule esb usecaseMule esb usecase
Mule esb usecase
charan teja R
 

What's hot (18)

Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESB
 
Mule batch job
Mule batch jobMule batch job
Mule batch job
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mule
 
Mule testing
Mule   testingMule   testing
Mule testing
 
Mule
MuleMule
Mule
 
Mule maven
Mule mavenMule maven
Mule maven
 
Load balancer in mule
Load balancer in muleLoad balancer in mule
Load balancer in mule
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mule
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Testing mule
Testing   muleTesting   mule
Testing mule
 
Introduction testingmule
Introduction testingmuleIntroduction testingmule
Introduction testingmule
 
Mule velocity
Mule velocityMule velocity
Mule velocity
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
 
Mule - logger
Mule -  loggerMule -  logger
Mule - logger
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Mule esb usecase
Mule esb usecaseMule esb usecase
Mule esb usecase
 

Similar to Maven tools & archetypes

Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
Mohan Arumugam
 
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
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
Vishnukanth Rachineni
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolelliando dias
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
VirtusaPolaris
 
Mule ESB
Mule ESBMule ESB
Mule ESB
Yura Nosenko
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
Raghavan Mohan
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
venkata20k
 
quickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudquickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudjorgesimao71
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeHolasz Kati
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
Antons Kranga
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
Dmitry Bakaleinik
 
Spring tutorial
Spring tutorialSpring tutorial
Spring tutorial
Sanjoy Kumer Deb
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
Antons Kranga
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
Toufiq Mahmud
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
Anand kalla
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
Steve Keener
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
ssuser65180a
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Dilouar Hossain
 

Similar to Maven tools & archetypes (20)

Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
 
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
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
Unit5 servlets
Unit5 servletsUnit5 servlets
Unit5 servlets
 
quickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudquickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloud
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafe
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
Spring tutorial
Spring tutorialSpring tutorial
Spring tutorial
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 

More from Son Nguyen

Your new maven friend – the mule maven
Your new maven friend – the mule mavenYour new maven friend – the mule maven
Your new maven friend – the mule maven
Son Nguyen
 
Soa governance for the modern business
Soa governance for the modern businessSoa governance for the modern business
Soa governance for the modern business
Son Nguyen
 
Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!
Son Nguyen
 
Let api change your relationship with your doctor
Let api change your relationship with your doctorLet api change your relationship with your doctor
Let api change your relationship with your doctor
Son Nguyen
 
Increase revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with apiIncrease revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with api
Son Nguyen
 
How to – wrap soap web service around a database
How to – wrap soap web service around a databaseHow to – wrap soap web service around a database
How to – wrap soap web service around a database
Son Nguyen
 
How to – rest api proxy to soap webservice
How to – rest api proxy to soap webserviceHow to – rest api proxy to soap webservice
How to – rest api proxy to soap webservice
Son Nguyen
 
Anypoint runtime manager v1
Anypoint runtime manager v1Anypoint runtime manager v1
Anypoint runtime manager v1
Son Nguyen
 
A good api strategy can help turn your
A good api strategy can help turn yourA good api strategy can help turn your
A good api strategy can help turn your
Son Nguyen
 
10 steps to design and build the perfect
10 steps to design and build the perfect10 steps to design and build the perfect
10 steps to design and build the perfect
Son Nguyen
 
What is the difference between using private flow
What is the difference between using private flowWhat is the difference between using private flow
What is the difference between using private flow
Son Nguyen
 
Real time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafkaReal time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafka
Son Nguyen
 
Performance tuning in mule
Performance tuning in mulePerformance tuning in mule
Performance tuning in mule
Son Nguyen
 
Mule intelli j tips
Mule intelli j tipsMule intelli j tips
Mule intelli j tips
Son Nguyen
 
Introducing the anypoint connector for redis
Introducing the anypoint connector for redisIntroducing the anypoint connector for redis
Introducing the anypoint connector for redis
Son Nguyen
 
How to – data integrity checks in batch processing
How to – data integrity checks in batch processingHow to – data integrity checks in batch processing
How to – data integrity checks in batch processing
Son Nguyen
 
How soa paved the way for cloud
How soa paved the way for cloudHow soa paved the way for cloud
How soa paved the way for cloud
Son Nguyen
 
Mq user and role access
Mq user and role accessMq user and role access
Mq user and role access
Son Nguyen
 
Anypoint mq queues and exchanges
Anypoint mq queues and exchangesAnypoint mq queues and exchanges
Anypoint mq queues and exchanges
Son Nguyen
 
Anypoint mq acknowledgement mode
Anypoint mq acknowledgement modeAnypoint mq acknowledgement mode
Anypoint mq acknowledgement mode
Son Nguyen
 

More from Son Nguyen (20)

Your new maven friend – the mule maven
Your new maven friend – the mule mavenYour new maven friend – the mule maven
Your new maven friend – the mule maven
 
Soa governance for the modern business
Soa governance for the modern businessSoa governance for the modern business
Soa governance for the modern business
 
Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!
 
Let api change your relationship with your doctor
Let api change your relationship with your doctorLet api change your relationship with your doctor
Let api change your relationship with your doctor
 
Increase revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with apiIncrease revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with api
 
How to – wrap soap web service around a database
How to – wrap soap web service around a databaseHow to – wrap soap web service around a database
How to – wrap soap web service around a database
 
How to – rest api proxy to soap webservice
How to – rest api proxy to soap webserviceHow to – rest api proxy to soap webservice
How to – rest api proxy to soap webservice
 
Anypoint runtime manager v1
Anypoint runtime manager v1Anypoint runtime manager v1
Anypoint runtime manager v1
 
A good api strategy can help turn your
A good api strategy can help turn yourA good api strategy can help turn your
A good api strategy can help turn your
 
10 steps to design and build the perfect
10 steps to design and build the perfect10 steps to design and build the perfect
10 steps to design and build the perfect
 
What is the difference between using private flow
What is the difference between using private flowWhat is the difference between using private flow
What is the difference between using private flow
 
Real time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafkaReal time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafka
 
Performance tuning in mule
Performance tuning in mulePerformance tuning in mule
Performance tuning in mule
 
Mule intelli j tips
Mule intelli j tipsMule intelli j tips
Mule intelli j tips
 
Introducing the anypoint connector for redis
Introducing the anypoint connector for redisIntroducing the anypoint connector for redis
Introducing the anypoint connector for redis
 
How to – data integrity checks in batch processing
How to – data integrity checks in batch processingHow to – data integrity checks in batch processing
How to – data integrity checks in batch processing
 
How soa paved the way for cloud
How soa paved the way for cloudHow soa paved the way for cloud
How soa paved the way for cloud
 
Mq user and role access
Mq user and role accessMq user and role access
Mq user and role access
 
Anypoint mq queues and exchanges
Anypoint mq queues and exchangesAnypoint mq queues and exchanges
Anypoint mq queues and exchanges
 
Anypoint mq acknowledgement mode
Anypoint mq acknowledgement modeAnypoint mq acknowledgement mode
Anypoint mq acknowledgement mode
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

Maven tools & archetypes

  • 1. Maven Tools & Archetypes
  • 2. • For a while now there have been maven archetypes for creating mule apps and domains. Such archetypes make getting started with development easier by automatically generating the basic core structure and files of mule projects (think configuration files, test classes, pom). This is especially interesting since the introduction in 3.5.0 of shared resources through mule domains which could make your app depend on another external project (a domain) and using Maven to manage dependencies makes perfect sense. We will see how to use these archetypes to create a domain and an application that uses it.
  • 3. Creating a domain • We’ll start by creating a domain where we’ll define an HTTP listener to be shared. • mvn archetype:generate -DarchetypeGroupId=org.mule.tools.maven - DarchetypeArtifactId=maven-archetype-mule-domain - DarchetypeVersion=1.1 -DgroupId=org.myfakecompany.domain - DartifactId=my-mule-domain -Dversion=1.0-SNAPSHOT - Dpackage=org.myfakecompany.domain
  • 4. This will create a project named my-mule-domain that contains a mule-domain-config.xml file where we can define our listener config:<?xml version="1.0" encoding="UTF-8"?> <domain:mule-domain xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:domain="http://www.mulesoft.org/schema/mule/domain" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/domain http://www.mulesoft.org/schema/mule/domain/current/mule-domain.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> <!-- configure here resources to be shared within the domain --> <http:listener-config host="localhost" port="8081" basePath="domain" name="listenerConfig"/> </domain:mule-domain>
  • 5. Creating an app • Now we’ll create a project for an app that uses my-mule-domain. In this case, we can indicate which transports and modules we’ll be starting with and the mule version we’ll be using. • mvn archetype:generate -DarchetypeGroupId=org.mule.tools.maven - DarchetypeArtifactId=maven-archetype-mule-app -DarchetypeVersion=1.1 -DgroupId=org.myfakecompany.app -DartifactId=my-mule-app - Dversion=1.0-SNAPSHOT -DmuleVersion=3.7.0 - Dpackage=org.myfakecompany.app -Dtransports=http,vm - Dmodules=db,xml,ws -DdomainGroupId=org.myfakecompany.domain - DdomainArtifactId=my-mule-domain -DdomainVersion=1.0-SNAPSHOT
  • 6. • This will create a project named my-mule-app that contains a mule app configuration file already set up with the namespaces of the transports and modules indicated, as well as the dependencies for them set up in the project’s pom file. In there you’ll also find a mule- deploy.properties file with the domain specified to my-mule-domain and an ExampleFunctionalTestCase for our app.
  • 7. Let’s modify the app to use the shared HTTP listener and it’s test accordingly. We’ll get rid of the vm endpoints and extra initial message processors and add our listener: <flow name="main"> <http:listener config-ref="listenerConfig" path="test"/> <set-payload value="Received" /> </flow>
  • 8. In ExampleFunctionalTestCase we can now use the MuleClient to send a request to “http://localhost:8081/domain/test”. Let’s replace the vm related client code and modify the expected payload since now we’ll be expecting “Received”: @Test public void testConfiguration() throws Exception { MuleClient client = getMuleContextForApp("myApp").getClient(); MuleMessage message = new DefaultMuleMessage("some data", getMuleContextForApp("myApp")); MuleMessage result = client.send("http://localhost:8081/domain/test", message); assertNotNull(result); assertNull(result.getExceptionPayload()); assertFalse(result.getPayload() instanceof NullPayload); assertEquals("Received", result.getPayloadAsString()); }
  • 9. • That’s it, we now have an application that’s using a listener defined in a domain AND a test case for it. This works because the external domain project is added as a dependency of our project, as well as a Maven plugin to unpack it’s configuration file, all of which was set up when we created the app through the archetype. Just compile everything and run the test.
  • 10. Extra • Archetypes are not all there is to offer for Maven projects though. Each of the projects mentioned above uses a special maven plugin to manage the packaging into deployable .zip files. • If I want to generate the deployable .zip for my domain I just have to run: mvn package