São Paulo MuleSoft Meetup Group
Code reusability with Mule Shared Flows
2
● Introductions
● Code reusability with Mule Shared Flows: Concepts
● Reusable Code: Pros and Cons
● Demo - How to implement Mule Shared Flows
● Questions / Comments
Agenda
3
●About me:
○ José Luis Clua (15+ in IT)
○ Company: Capgemini
○ Natural e residente de São josé dos Campos – SP
○ Formado em Ciência da Computação na UNIVAP em 2005
○ 4+ years Integration experience
○ 2+ years with MuleSoft
○ MCD (MuleSoft Certified Developer)
Introductions
Code reusability with Mule Shared
Flows
5
What are Flows?
A flow is a pipeline of message processors.
Flows consist of 3 parts:
• Event Source
• Process
• Error Handling
A private flow is a flow that can’t be accessed from
outside the Mule app because it has no source
defined.
A subflow has no Event Source and no Error
Handling scope.
XML FILE
MULE APPLICATION
6
What are Shared Flows?
MULE APPLICATION 1 MULE APPLICATION 2
REPOSITORY
MULE PLUGIN
MULE PLUGIN
Dependency
MULE PLUGIN
Dependency
CTRL + C...
CTRL + V:
7
API LED Connectivity and Shared Flows
EXP
PRC
SYS
MULE-PLUGIN
REPOSITORY
8
● Shared Flows (a.k.a. Common Flows or Global Flows):
○ Flows that we can shared across multiple applications
○ Shared Flows are created in Mule Plugin projects
○ Mule Plugins can host many Shared Flows
○ Mule Plugins can be published in external repositories (Exchange, Jfrog,
Nexus, etc)
○ Mule Plugins can be added as a library (dependency in POM file)
What are Shared Flows?
9
● PROS
○ Code reusability (DRY principle – Don´t Repeat Yourself)
○ Easier maintainability
○ Faster development
○ Saving runtime resources
○ Promote code standards
○ Creating Project Templates
● CONS
○ Can lead to unflexible solutions
○ Demand efficient testing and version control
○ Can create a new layer of complexity
Reusable Code: Pros and Cons
10
● Shared Flows are well suited for basic, common, repetitive funtionality such as:
○ Error Handling
○ API health check
○ Logging
○ Caching
○ Data lookup
○ Simple tasks that are repetitive
When use Shared Flows?
11
How to manage dependencies?
MULE PLUGIN
MULE APPLICATION 1
DEPENDENCIES
<SCOPE>PROVIDED</SCOPE>
MULE PLUGIN
MULE APPLICATION 2
DEPENDENCIES
MULE PLUGIN
Demo
13
Shared Flows - Demo
customers-papi
users-papi
14
Shared Flows - Demo
Questions / Comments
16
● MuleSoft Training:
○ Anypoint Platform Development: Production-Ready Development Practices
(Mule 4)
● MuleSoft Documentation:
○ Flows and Subflows
○ Flow and Subflow scopes
Reference
Thank you

MuleSoft MuleSoft Meetup - Shared Flows

  • 1.
    São Paulo MuleSoftMeetup Group Code reusability with Mule Shared Flows
  • 2.
    2 ● Introductions ● Codereusability with Mule Shared Flows: Concepts ● Reusable Code: Pros and Cons ● Demo - How to implement Mule Shared Flows ● Questions / Comments Agenda
  • 3.
    3 ●About me: ○ JoséLuis Clua (15+ in IT) ○ Company: Capgemini ○ Natural e residente de São josé dos Campos – SP ○ Formado em Ciência da Computação na UNIVAP em 2005 ○ 4+ years Integration experience ○ 2+ years with MuleSoft ○ MCD (MuleSoft Certified Developer) Introductions
  • 4.
    Code reusability withMule Shared Flows
  • 5.
    5 What are Flows? Aflow is a pipeline of message processors. Flows consist of 3 parts: • Event Source • Process • Error Handling A private flow is a flow that can’t be accessed from outside the Mule app because it has no source defined. A subflow has no Event Source and no Error Handling scope. XML FILE MULE APPLICATION
  • 6.
    6 What are SharedFlows? MULE APPLICATION 1 MULE APPLICATION 2 REPOSITORY MULE PLUGIN MULE PLUGIN Dependency MULE PLUGIN Dependency CTRL + C... CTRL + V:
  • 7.
    7 API LED Connectivityand Shared Flows EXP PRC SYS MULE-PLUGIN REPOSITORY
  • 8.
    8 ● Shared Flows(a.k.a. Common Flows or Global Flows): ○ Flows that we can shared across multiple applications ○ Shared Flows are created in Mule Plugin projects ○ Mule Plugins can host many Shared Flows ○ Mule Plugins can be published in external repositories (Exchange, Jfrog, Nexus, etc) ○ Mule Plugins can be added as a library (dependency in POM file) What are Shared Flows?
  • 9.
    9 ● PROS ○ Codereusability (DRY principle – Don´t Repeat Yourself) ○ Easier maintainability ○ Faster development ○ Saving runtime resources ○ Promote code standards ○ Creating Project Templates ● CONS ○ Can lead to unflexible solutions ○ Demand efficient testing and version control ○ Can create a new layer of complexity Reusable Code: Pros and Cons
  • 10.
    10 ● Shared Flowsare well suited for basic, common, repetitive funtionality such as: ○ Error Handling ○ API health check ○ Logging ○ Caching ○ Data lookup ○ Simple tasks that are repetitive When use Shared Flows?
  • 11.
    11 How to managedependencies? MULE PLUGIN MULE APPLICATION 1 DEPENDENCIES <SCOPE>PROVIDED</SCOPE> MULE PLUGIN MULE APPLICATION 2 DEPENDENCIES MULE PLUGIN
  • 12.
  • 13.
    13 Shared Flows -Demo customers-papi users-papi
  • 14.
  • 15.
  • 16.
    16 ● MuleSoft Training: ○Anypoint Platform Development: Production-Ready Development Practices (Mule 4) ● MuleSoft Documentation: ○ Flows and Subflows ○ Flow and Subflow scopes Reference
  • 17.