Best practices that save time and effort for integration developers while working on their integration developments using WSO2 Enterprise Integrator.
Watch the webinar on-demand here: https://wso2.com/library/webinars/2019/07/tooling-best-practices-for-integration-experts/
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
Tooling Best Practices for Integration Experts
1. Tooling Best Practices for Integration Experts
Heshitha Hettihewa & Prabushi Samarakoon
WSO2 Integration Team
2. Agenda
• How to develop an integration scenario following best
practices
• Supported project & artifact types and their usages
• Naming conventions
• Useful shortcuts
• Native logging practices
• Message transformation conventions
• IDE Concepts
3. Developer Scenario
• A developer needs to implement a ‘User Registration’
System
• He wants to test the configurations in his QA environment
before deploying them in the production environment
• Some of the configurations in these two environments can
differ due to their infrastructure
4. User Registration Process
Register an
user request
Send an email
Process
registration
Registration
status response
Registration success
response
Registration
processing backend
system
Store registration
details in database
7. Project Types
• Maven Multi Module Project
• ESB Solution Project
• Composite Application Project
• Registry Resources Project
• Connector Exporter Project
• Data Service Project
• Data Source Project
• BPEL Project
• Human Task Project
• BPMN Project
• Mediator Project
8. Artifact Types
• Proxy Service
• REST API
• Sequence
• Endpoint
• Inbound Endpoint
• Message Processor
• Message Store
• Scheduled Task
• Template
• Local Entry
• Data Service
9. ENTERPRISE
INTEGRATOR
Naming Conventions
Type Format Sample
Folders
<Project><FolderName>
Folder structure for registry resources;
<Project>/<ResourceType>/<subResourceType>
StudentInformationSystemLibraries
StudentInformationSystem/wsdl
StudentInformationSystem/xsd
StudentInformationSystem/schema/validate
StudentInformationSystem/schema/wsdl
Project
Name
<ProjectName> StudentInformationSystem
Source
Files
<ProjectName>_<FileName>_<Type>.<Extension>
Student_Student_Sequence.xml,
Stocks_StockQuote_FileInbound.xml
Sub
Modules
<Project><ModuleName> StudentInformationSystemDataService
10. ENTERPRISE
INTEGRATOR
Useful Shortcuts
Function Linux / Windows Mac
Copy Ctrl + c Command + c
Paste Ctrl + v Command + v
Cut Ctrl + x Command + x
Save Ctrl + s Command + s
Add block comment Ctrl + Shift + / Command + /
Remove block comment Ctrl + Shift + Command +
Remove line Ctrl + d Command + d
Un select Ctrl + click esc
Search in workspace Ctrl + Shift + r Command + Shift + r
Zoom in design view Ctrl + + Control + +
11. Log mediator
• Use in the message flow as checkpoints
• Not recommended to use in a production setup (Except in Fault
sequences)
• Important to use within the fault flow to isolate the issue
• Inbuilt properties can be used to retrieve the error details
– ERROR_MESSAGE
– ERROR_CODE
– ERROR_DETAIL
– ERROR_EXCEPTION
12. ENTERPRISE
INTEGRATOR
Message Transformation Conventions
Mediator Use Cases
Payload Factory Message format is fixed and there are less number of external inputs
ForEach Original message has repetitive elements that should be processed (use together
with the Payload Factory mediator)
Enrich Add/remove part of the/whole message
XSLT Transformation logic is complex and performance critical
Data Mapper
Change the structure of data in a message or convert and transform one data
format to another
Smooks Large file transformations
13. ForEach mediator
• Loops over the sub-messages and merges them back to the same parent
element of the message
• Does not allow using Call, Send and Callout mediators in the sequence
(Use an Iterate mediator instead)
• Does not split the message flow, unlike Iterate mediator
• Guarantees to execute in the same thread until all iterations are complete
14. Clone mediator
• Clones a message into several identical messages
• Use a Call mediator in the target sequence to bring the responses back
into the In-Sequence
• Similar to Iterate mediator, but it splits the message into different parts
15. ENTERPRISE
INTEGRATOR
Send | Call | Callout mediator
Mediator Use Cases
Send
● Sends a message, and the response comes to the OutSequence (or to the specified
receiving sequence)
● Uses non blocking transport
Call
● Sends a message, and the mediation flow will continue with the next mediator after
the send operation is done
● Recommended for service chaining scenarios
● Uses non blocking transport
Callout
● Behaviour is similar to Call mediator
● Uses blocking transport
● Performance is not good as Call or Send mediator because of the blocking nature
16. IDE Concepts - Perspectives
• Used to customize the IDE experience
• Consisted of view positionings, toolbar customizations etc. which will be
helpful when developing artifacts
• Effective use of the perspectives is very useful for development
• Several perspectives are used in Integration Studio;
– WSO2 ESB Graphical
– WSO2 Welcome
– WSO2 Data Mapper Graphical
– WSO2 Registry
– Debug
– BPEL
– Activiti
17. IDE Concepts - Views
• Views are the different window segments that IDE consists of
• Basically any sub window apart from the editors are known as a view in
Integration Studio
• Several views are used in Integration Studio;
– Project Explorer
– Console
– Properties
– Outline
– Template Guide
– Realtime Datamapper Preview
– Palette
– WSO2 Registry Browser
– Wire Log View
18. Connectors
• Use secure vault to secure user credentials
• To seamlessly refresh tokens, use a registry location that is visible to all
esb cluster members
• Use $ctx instead of the get-property() function to improve performance
19. Database mediators
• Use DB Report/ DB Lookup to process simple queries (Select, Insert)
• Use Data Services with complex scenarios such as retrieving multiple
rows, nested queries, etc.
20. Class | Custom mediator
• Should be used when the intended functionality cannot be achieved using
inbuilt mediators
• Consider the performance impact and possible memory leaks
• Follow Java naming conventions and best practices