SlideShare a Scribd company logo
1 of 37
Download to read offline
Integration

     &
         DSL
  #TDC2011
@porcelli




                                                                    Alexandre Porcelli
                                                                        Founder




Alexandre Porcelli
Writer


                     Alexandre Porcelli
                     Organizer

                                          Alexandre Porcelli
                                          Commiter / Parser Developer


                                                                         Alexandre Porcelli
                                                                         API Designer / Developer
integration
THE reference
cloud
problems...
silos
3443
#facts


✓   #1 OPEN SOURCE ESB
✓   OVER 1.5 MILLION DOWNLOADS
✓   2500+ PRODUCTION DEPLOYMENTS
✓   PERFORMANCE: 10000 TPS
✓   SCALABLE: 13000 DEPLOYED SERVERS
✓   100+ CONNECTORS APPS & PROTOCOLS
✓   CLOUD CONNECTORS
enterprise...
                                Mule ESB    Mule ESB
                                Community   Enterprise
  High-performance ESB                         
  Access to source code                        
  Community extensions                         
  Management Console                            
  High availability                             
  Premium Connectors                            
  Self-healing connections                      
  Technical Support                             
  Knowledge Base                                

  Service packs / hot patches                   

  QA                                            
  Enterprise documentation                      
  Enterprise license                            
customers...
mule studio!
tech spec...
cloud connectors...
POJO!
 @Connector(namespacePrefix="my-push")
 public class MyPushCloudConnector {
     /**
         * Hostname of My Push Notification Gateway
         */
     @Property
     private String host;


     @Operation
     public void send(String deviceToken, @Parameter(optional=true)
     String alert, @Parameter(optional=true) String sound, @Parameter
     (optional=true, defaultValue="-1") int badge, @Parameter
     (optional=true) Map<String,String> fields) {
              ...
     }
 }
<flow name="Hello World">
    <composite-source>
        <!-- Incoming HTTP requests -->
        <inbound-endpoint address="http://localhost:8888" transformer-refs="HttpRequestToNameString" exchange-pattern="request-response"
            <not-filter>
                <wildcard-filter pattern="/favicon.ico"/>
            </not-filter>
        </inbound-endpoint>

        <!-- Incoming Servlet requests -->
        <inbound-endpoint address="servlet://name" transformer-refs="HttpRequestToNameString" exchange-pattern="request-response">
            <not-filter>
                <wildcard-filter pattern="/favicon.ico"/>
            </not-filter>
        </inbound-endpoint>

        <!-- Incoming VM requests -->
        <vm:inbound-endpoint path="greeter" transformer-refs="StringToNameString" exchange-pattern="request-response"/>
    </composite-source>

    <component class="org.mule.example.hello.Greeter"/>

    <choice>
        <when expression="payload    instanceof org.mule.example.hello.NameString" evaluator="groovy">
             <vm:outbound-endpoint   path="chitchatter" exchange-pattern="request-response"/>
        </when>
        <when expression="payload    instanceof java.lang.Exception" evaluator="groovy">
             <vm:outbound-endpoint   path="userErrorHandler" exchange-pattern="request-response"/>
        </when>
    </choice>

    <!-- Route unexpected errors to separate error handler -->
    <default-exception-strategy>
        <vm:outbound-endpoint path="systemErrorHandler" exchange-pattern="one-way"/>
    </default-exception-strategy>
</flow>
xml?
so what?
MuleContex context = Mule.newMuleContext();

Flow myFlow = new Flow();

myFlow.setName("MyFlow");

InboundEndpoint myIn = new GenericInboundEndpoint();
myIn.setURL("file:///Users/porcelli/in");

OutboundEndpoint myOut = new GenericOutboundEndpoint();
myIn.setURL("file:///Users/porcelli/out");

myFlow.setInbound(myIn);
myFlow.addMessageProcessor(myOut);

context.addFlow(myFlow);




                                              ok?
muleContext.start();
NO!
DSL!
goals...

 ➡ Expressive & Natural
 ➡ Easy to Use & Learn
 ➡ Hard to Misuse
 ➡ Extensible
Mule.newMuleContext(new AbstractModule() {
    @Override
    public void configure() {
        flow("MyFlow")
                .from("file:///Users/porcelli/in")
                .send("file:///Users/porcelli/out");
    }
}).start();
remember?
MuleContex context = Mule.newMuleContext();

Flow myFlow = new Flow();

myFlow.setName("MyFlow");

InboundEndpoint myIn = new GenericInboundEndpoint();
myIn.setURL("file:///Users/porcelli/in");

OutboundEndpoint myOut = new GenericOutboundEndpoint();
myIn.setURL("file:///Users/porcelli/out");

myFlow.setInbound(myIn);
myFlow.addMessageProcessor(myOut);

context.addFlow(myFlow);

muleContext.start();
feedback?
cloud...
final TwitterConnector twitterConnector = new TwitterConnector();
twitterConnector.setConsumerKey("key");
twitterConnector.setConsumerSecret("secret");
twitterConnector.setOathToken("token");

Mule.newMuleContext(new AbstractModule() {
    @Override
    public void configure() {
        flow("MyFlow")
                .from("file:///Users/porcelli/tweet")
                .transformTo(String.class)
                .process(twitterConnector.statusesUpdate(payload()));
    }
}).start();
demo
questions?
Thanks!


                    alexandre.porcelli@gmail.com

                    github.com/porcelli

about.me/porcelli   linkedin.com/in/alexandreporcelli

                    @porcelli

                    porcelli.com.br

More Related Content

Similar to Integration & DSL

PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
grim_radical
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
erikmsp
 

Similar to Integration & DSL (20)

How to best setup SharePoint 2013, Web Apps, Workflow Manager with Powershell
How to best setup SharePoint 2013, Web Apps, Workflow Manager with PowershellHow to best setup SharePoint 2013, Web Apps, Workflow Manager with Powershell
How to best setup SharePoint 2013, Web Apps, Workflow Manager with Powershell
 
Service Discovery Like a Pro
Service Discovery Like a ProService Discovery Like a Pro
Service Discovery Like a Pro
 
Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote
 
Puppet Camp Tokyo 2014: Keynote
Puppet Camp Tokyo 2014: KeynotePuppet Camp Tokyo 2014: Keynote
Puppet Camp Tokyo 2014: Keynote
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
Indeed Flex: The Story of a Revolutionary Recruitment Platform
Indeed Flex: The Story of a Revolutionary Recruitment PlatformIndeed Flex: The Story of a Revolutionary Recruitment Platform
Indeed Flex: The Story of a Revolutionary Recruitment Platform
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
 
RavenDB overview
RavenDB overviewRavenDB overview
RavenDB overview
 
How to Treat a Network Like a Container (Or Get Close)
How to Treat a Network Like a Container (Or Get Close)How to Treat a Network Like a Container (Or Get Close)
How to Treat a Network Like a Container (Or Get Close)
 
All Things Open 2017: How to Treat a Network as a Container
All Things Open 2017: How to Treat a Network as a ContainerAll Things Open 2017: How to Treat a Network as a Container
All Things Open 2017: How to Treat a Network as a Container
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
 
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShiftReal world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShift
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
 
Practical, team-focused operability techniques for distributed systems - DevO...
Practical, team-focused operability techniques for distributed systems - DevO...Practical, team-focused operability techniques for distributed systems - DevO...
Practical, team-focused operability techniques for distributed systems - DevO...
 
PipelineAI + TensorFlow AI + Spark ML + Kuberenetes + Istio + AWS SageMaker +...
PipelineAI + TensorFlow AI + Spark ML + Kuberenetes + Istio + AWS SageMaker +...PipelineAI + TensorFlow AI + Spark ML + Kuberenetes + Istio + AWS SageMaker +...
PipelineAI + TensorFlow AI + Spark ML + Kuberenetes + Istio + AWS SageMaker +...
 
What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 

More from Alexandre Porcelli

QConSP 2013 - Não confunda engenharia de software com lean startup
QConSP 2013 - Não confunda engenharia de software com lean startupQConSP 2013 - Não confunda engenharia de software com lean startup
QConSP 2013 - Não confunda engenharia de software com lean startup
Alexandre Porcelli
 
JUDCon São Paulo - Drools in a Nutshell
JUDCon São Paulo - Drools in a NutshellJUDCon São Paulo - Drools in a Nutshell
JUDCon São Paulo - Drools in a Nutshell
Alexandre Porcelli
 
noSQL e ORM, será que dá samba?
noSQL e ORM, será que dá samba?noSQL e ORM, será que dá samba?
noSQL e ORM, será que dá samba?
Alexandre Porcelli
 
noSQL - Uma nova escola de pensamento
noSQL - Uma nova escola de pensamentonoSQL - Uma nova escola de pensamento
noSQL - Uma nova escola de pensamento
Alexandre Porcelli
 
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em JavaJ1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
Alexandre Porcelli
 

More from Alexandre Porcelli (20)

Dawn of the citizen developer
Dawn of the citizen developerDawn of the citizen developer
Dawn of the citizen developer
 
Running rules and processes in the cloud
Running rules and processes in the cloudRunning rules and processes in the cloud
Running rules and processes in the cloud
 
Impulsione sua carreira contribuindo para projetos open source
Impulsione sua carreira contribuindo para projetos open sourceImpulsione sua carreira contribuindo para projetos open source
Impulsione sua carreira contribuindo para projetos open source
 
QConSP 2013 - Não confunda engenharia de software com lean startup
QConSP 2013 - Não confunda engenharia de software com lean startupQConSP 2013 - Não confunda engenharia de software com lean startup
QConSP 2013 - Não confunda engenharia de software com lean startup
 
JUDCon São Paulo - Drools in a Nutshell
JUDCon São Paulo - Drools in a NutshellJUDCon São Paulo - Drools in a Nutshell
JUDCon São Paulo - Drools in a Nutshell
 
NoSQL for the rest of us - a JBoss perspective over those hot tools and how y...
NoSQL for the rest of us - a JBoss perspective over those hot tools and how y...NoSQL for the rest of us - a JBoss perspective over those hot tools and how y...
NoSQL for the rest of us - a JBoss perspective over those hot tools and how y...
 
Armazenamento de Dados em Poucas Palavras ou Uma resposta definitiva para tod...
Armazenamento de Dados em Poucas Palavras ou Uma resposta definitiva para tod...Armazenamento de Dados em Poucas Palavras ou Uma resposta definitiva para tod...
Armazenamento de Dados em Poucas Palavras ou Uma resposta definitiva para tod...
 
DevinVale: SQL, noSQL ou newSQL - Onde armazenar meus dados?
DevinVale:  SQL, noSQL ou newSQL - Onde armazenar meus dados?DevinVale:  SQL, noSQL ou newSQL - Onde armazenar meus dados?
DevinVale: SQL, noSQL ou newSQL - Onde armazenar meus dados?
 
noSQL e ORM, será que dá samba?
noSQL e ORM, será que dá samba?noSQL e ORM, será que dá samba?
noSQL e ORM, será que dá samba?
 
noSQL - Uma nova escola de pensamento
noSQL - Uma nova escola de pensamentonoSQL - Uma nova escola de pensamento
noSQL - Uma nova escola de pensamento
 
noSQL @ MSTechDay São Paulo
noSQL @ MSTechDay São PaulonoSQL @ MSTechDay São Paulo
noSQL @ MSTechDay São Paulo
 
SQL, NoSQL ou NewSQL: Onde armazenar meus dados?
SQL, NoSQL ou NewSQL: Onde armazenar meus dados?SQL, NoSQL ou NewSQL: Onde armazenar meus dados?
SQL, NoSQL ou NewSQL: Onde armazenar meus dados?
 
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
 
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em JavaJ1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
J1Brasil: Persistência de Dados além do JPA, ou Como usar noSQL em Java
 
noSQL WTF?! - Citi2010
noSQL WTF?! - Citi2010noSQL WTF?! - Citi2010
noSQL WTF?! - Citi2010
 
noSQL @ QCon SP
noSQL @ QCon SPnoSQL @ QCon SP
noSQL @ QCon SP
 
noSQL além do buzz
noSQL além do buzznoSQL além do buzz
noSQL além do buzz
 
GraphDatabases @ TDC2010
GraphDatabases @ TDC2010GraphDatabases @ TDC2010
GraphDatabases @ TDC2010
 
Motor de Regras @ TDC2010
Motor de Regras @ TDC2010Motor de Regras @ TDC2010
Motor de Regras @ TDC2010
 
OpenSpotLight - Concepts
OpenSpotLight - ConceptsOpenSpotLight - Concepts
OpenSpotLight - Concepts
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Integration & DSL

  • 1. Integration & DSL #TDC2011
  • 2. @porcelli Alexandre Porcelli Founder Alexandre Porcelli Writer Alexandre Porcelli Organizer Alexandre Porcelli Commiter / Parser Developer Alexandre Porcelli API Designer / Developer
  • 4.
  • 5.
  • 10. 3443
  • 11.
  • 12. #facts ✓ #1 OPEN SOURCE ESB ✓ OVER 1.5 MILLION DOWNLOADS ✓ 2500+ PRODUCTION DEPLOYMENTS ✓ PERFORMANCE: 10000 TPS ✓ SCALABLE: 13000 DEPLOYED SERVERS ✓ 100+ CONNECTORS APPS & PROTOCOLS ✓ CLOUD CONNECTORS
  • 13. enterprise... Mule ESB Mule ESB Community Enterprise High-performance ESB   Access to source code   Community extensions   Management Console  High availability  Premium Connectors  Self-healing connections  Technical Support  Knowledge Base  Service packs / hot patches  QA  Enterprise documentation  Enterprise license 
  • 18. POJO! @Connector(namespacePrefix="my-push") public class MyPushCloudConnector { /** * Hostname of My Push Notification Gateway */ @Property private String host; @Operation public void send(String deviceToken, @Parameter(optional=true) String alert, @Parameter(optional=true) String sound, @Parameter (optional=true, defaultValue="-1") int badge, @Parameter (optional=true) Map<String,String> fields) { ... } }
  • 19.
  • 20.
  • 21. <flow name="Hello World"> <composite-source> <!-- Incoming HTTP requests --> <inbound-endpoint address="http://localhost:8888" transformer-refs="HttpRequestToNameString" exchange-pattern="request-response" <not-filter> <wildcard-filter pattern="/favicon.ico"/> </not-filter> </inbound-endpoint> <!-- Incoming Servlet requests --> <inbound-endpoint address="servlet://name" transformer-refs="HttpRequestToNameString" exchange-pattern="request-response"> <not-filter> <wildcard-filter pattern="/favicon.ico"/> </not-filter> </inbound-endpoint> <!-- Incoming VM requests --> <vm:inbound-endpoint path="greeter" transformer-refs="StringToNameString" exchange-pattern="request-response"/> </composite-source> <component class="org.mule.example.hello.Greeter"/> <choice> <when expression="payload instanceof org.mule.example.hello.NameString" evaluator="groovy"> <vm:outbound-endpoint path="chitchatter" exchange-pattern="request-response"/> </when> <when expression="payload instanceof java.lang.Exception" evaluator="groovy"> <vm:outbound-endpoint path="userErrorHandler" exchange-pattern="request-response"/> </when> </choice> <!-- Route unexpected errors to separate error handler --> <default-exception-strategy> <vm:outbound-endpoint path="systemErrorHandler" exchange-pattern="one-way"/> </default-exception-strategy> </flow>
  • 22. xml?
  • 23.
  • 25.
  • 26. MuleContex context = Mule.newMuleContext(); Flow myFlow = new Flow(); myFlow.setName("MyFlow"); InboundEndpoint myIn = new GenericInboundEndpoint(); myIn.setURL("file:///Users/porcelli/in"); OutboundEndpoint myOut = new GenericOutboundEndpoint(); myIn.setURL("file:///Users/porcelli/out"); myFlow.setInbound(myIn); myFlow.addMessageProcessor(myOut); context.addFlow(myFlow); ok? muleContext.start();
  • 27. NO!
  • 28. DSL!
  • 29. goals... ➡ Expressive & Natural ➡ Easy to Use & Learn ➡ Hard to Misuse ➡ Extensible
  • 30. Mule.newMuleContext(new AbstractModule() { @Override public void configure() { flow("MyFlow") .from("file:///Users/porcelli/in") .send("file:///Users/porcelli/out"); } }).start();
  • 31. remember? MuleContex context = Mule.newMuleContext(); Flow myFlow = new Flow(); myFlow.setName("MyFlow"); InboundEndpoint myIn = new GenericInboundEndpoint(); myIn.setURL("file:///Users/porcelli/in"); OutboundEndpoint myOut = new GenericOutboundEndpoint(); myIn.setURL("file:///Users/porcelli/out"); myFlow.setInbound(myIn); myFlow.addMessageProcessor(myOut); context.addFlow(myFlow); muleContext.start();
  • 33. cloud... final TwitterConnector twitterConnector = new TwitterConnector(); twitterConnector.setConsumerKey("key"); twitterConnector.setConsumerSecret("secret"); twitterConnector.setOathToken("token"); Mule.newMuleContext(new AbstractModule() { @Override public void configure() { flow("MyFlow") .from("file:///Users/porcelli/tweet") .transformTo(String.class) .process(twitterConnector.statusesUpdate(payload())); } }).start();
  • 34. demo
  • 35.
  • 37. Thanks! alexandre.porcelli@gmail.com github.com/porcelli about.me/porcelli linkedin.com/in/alexandreporcelli @porcelli porcelli.com.br