Best Practices Guide Introduction¶ This guide provides best practices for designing, developing, deploying, and maintaining integration solutions with WSO2 Integrator: MI. It is intended for integration developers, architects, and DevOps engineers aiming to build scalable, secure, and maintainable solutions. Development Best Practices¶ General development guidelines¶ Always use the latest version of the WSO2 Integrator: MI extension for VS Code. It is recommended to update the extension frequently to get the latest features and bug fixes. Use the UI provided by the WSO2 Integrator: MI extension for VS Code to create and manage your integration projects. This ensures that your projects are set up correctly and follow best practices. You can use manual editing only for advanced configurations not supported by the UI. Create projects¶ Create a separate project for each microservice or integration usecase. This approach enhances organization, streamlines artifact management, and facilitates easier maintenance and updates of individual integrations. Create a multi-module project for managing multiple related services that need to be deployed together. This allows you to manage dependencies and shared resources effectively. Apply semantic versioning to both projects and artifacts to clearly communicate the impact of changes (major, minor, patch). This helps manage updates, track dependencies, and ensure compatibility across integration solutions. Sample versioning scheme: 1.0.1, 1.1.0, 2.0.0 Include a changelog (a record of changes) in your project to document updates, improvements, and fixes for each version. Naming conventions¶ Use meaningful names for your projects to identify their purpose easily. Use a meaningful group ID that reflects your organization or team, or logically groups related projects together. For example, use com.companyname or org.departmentname. Be sure to give the same group ID to related projects. Use a meaningful artifact ID that reflects the specific project or module. For example, use order-service or payment-gateway. Follow a consistent naming convention for your artifacts to easily identify their purpose and functionality. For example, use OrderAPI, PaymentSequence, or InventoryEndpoint. Type Description Format Sample Project Name The root directory of the project's source code. Make it reflect the project's purpose. <ProjectName> StudentInformationSystem Artifacts The synapse artifacts that are created for your integration projects. These include sequences, endpoints, proxy services, etc. <ArtifactName><Type> GetStudentSequence, SimpleStockQuoteProxyService Registry resource folder structure Organize resources using custom folders that clearly indicate the type or logical category of each resource. Ensure the folder structure is intuitive and reflects the contents, such as grouping schemas, WSDLs, and XSDs into separate, well-named directories for easier management and discovery. <Project>/<ResourceType>/<subResourceType> StudentInformationSystem ├── Schema ├── wsdl └── xsd Artifacts Best Practices¶ Working with APIs¶ Choose clear, descriptive names for APIs that accurately reflect their functionality and business domain. Follow a consistent naming convention, such as StudentAPI, OrderAPI, or PaymentAPI, to improve discoverability and maintainability. Apply versioning to APIs to manage changes, communicate updates, and ensure backward compatibility. Document version changes and deprecations clearly. Design and implement a Fault Sequence for each API to handle errors consistently and provide clear feedback to consumers. Ensure error responses include relevant details such as error codes, messages, and correlation IDs for easier troubleshooting. Structure APIs to be intuitive and easy to consume. Define resources and operations following RESTful conventions, and use meaningful HTTP methods and status codes. Implement the logic that handles the response in the In Sequence instead of the Out Sequence. Note Existing APIs that use an Out Sequence continue to work, so you do not need to change them. If you want to move the logic to the In Sequence, see Using New Mediators in Existing Integrations. Mediators & Connectors Best Practices¶ General mediator usage¶ Add a proper description to each mediator to clarify its purpose and usage within the integration flow. Prefer the Variable mediator over the Property mediator for storing intermediate values during message mediation, as it provides a simpler development experience. Reserve the Property Mediator for controlling message flow, such as setting properties that influence routing, error handling, or other flow-specific logic. Use clear, descriptive variable names to enhance the readability and maintainability of your integration logic. If you want to repeatedly use the same mediation sequence, define it as a Sequence. You can then invoke this reusable sequence from your main sequence, multiple proxy services, or REST APIs. Use the Call Sequence mediator to call the saved sequence, or select it as the InSequence or FaultSequence when configuring a proxy service or REST API. This approach promotes modularity, reduces duplication, and simplifies maintenance across your integration flows. General connector usage¶ Reuse shared connections across multiple integrations whenever possible to optimize resource usage and enhance performance. Connection pooling is managed per connection, so minimizing the number of distinct connections helps reduce overhead and improve scalability. Create separate connections only when required, such as for high-throughput integrations. Dedicated connections provide isolated connection pools, which can be beneficial for integrations that demand high availability. Log mediator¶ Use Log Mediator as checkpoints in message flows to track and debug integration logic. In development, set the log category to DEBUG and configure the global log level for org.apache.synapse.mediators.builtin.LogMediator accordingly. Include relevant payload information, request metadata (e.g. timestamp), and unique identifiers (e.g., correlation IDs) to aid in troubleshooting and tracing requests across services. In production, restrict Log Mediator to Fault sequences to avoid excessive logging and performance overhead. Always log key error details such as ERROR_CODE and use correlation IDs to link related log entries. Place Log Mediator within Fault sequences to ensure error information is captured in wso2carbon.log. Set the global log level to INFO to enable essential troubleshooting without exposing sensitive or verbose information. Avoid logging sensitive information, such as user credentials or personal data, to protect privacy and comply with data protection regulations. Use descriptive messages and implement structured logging to capture key attributes and context information in a consistent format. Regularly review and adjust log levels to balance visibility and performance. Configure log masking to protect sensitive information in your logs. Follow the masking sensitive information in logs guide to set up appropriate log masking settings and ensure compliance with security and privacy requirements. Custom mediator / Ballerina module¶ Avoid writing a Class mediator or custom Ballerina module if the required functionality can be achieved using the built-in mediators and connectors of WSO2 Integrator: MI. This reduces maintenance overhead and leverages native features. Review the Mediator Catalog and Connectors to understand the capabilities of built-in mediators and connectors. This helps ensure you leverage existing features and avoid unnecessary custom development. If you must implement a Class mediator or a custom Ballerina module, ensure you understand its performance implications and monitor for potential memory leaks or resource issues. Use meaningful and properly structured Java package names for Class mediators, and follow Ballerina module naming conventions for custom modules to maintain clarity and organization. Follow standard Java and Ballerina naming conventions and code best practices when developing Class mediators or Ballerina modules to ensure maintainability and readability. Document the purpose, usage, and configuration of your custom mediator or Ballerina module to help other developers understand and use them effectively. HTTP Connector¶ Prefer using the HTTP Connector for a simpler developer experience when making non-blocking outbound HTTP calls instead of using the Call Mediator or Send Mediator with endpoints. Always use the latest version of the HTTP Connector to take advantage of new features. Foreach mediator¶ Whenever possible, enable the Execute Parallel property in the ForEach Mediator to process iterations concurrently. This can significantly improve performance, especially when handling large datasets or making multiple outbound calls. Ensure that your integration logic is thread-safe and that parallel execution does not introduce race conditions or resource contention. Enable the Continue without aggregation property in the ForEach Mediatorr to optimize performance when response aggregation is not required. This setting allows the mediator to proceed without waiting for responses from outbound calls made during each iteration, reducing latency and improving throughput. Message transformation¶ PayloadFactory Mediator: Use when you need to reconstruct the entire message payload into a simple, fixed format. Ideal for scenarios where only a few parameters are extracted from the original message and the output structure is predictable. For-Each + PayloadFactory Mediator: Use this combination when the original message contains repetitive segments that need to be transformed individually. The ForEach Mediator iterates over each segment, and the PayloadFactory Mediator constructs the new format for each segment, similar to the For-Each function in XSLT. Data Mapper Mediator: Use when you need to change the structure of data in a message or convert one data format to another. Enrich Mediator: Use when only a small part of the message needs to be modified, such as adding or removing an element, without reconstructing the entire payload. XSLT Mediator: Use for complex transformation logic, including repetitive segments and conditional transformations. Note that XSLT transformations are handled by a third-party engine, which may impact performance. JSON Transform Mediator Best Practices: Use the JSON Transform mediator when you need to convert XML payloads to JSON or transform JSON structures within your integration flows. This mediator allows you to define transformation properties locally, enabling scenario-specific configurations rather than relying on global settings. Leverage the ability to specify a JSON schema in the mediator to validate and correct payloads during transformation. This helps ensure data consistency and prevents errors caused by schema mismatches. Note When using the XSLT mediator, be aware of potential performance impacts due to the use of a third-party transformation engine. Expression & data handling¶ Use the Synapse Expression Language for all JSON data manipulation and transformation tasks. It offers enhanced flexibility, and broader feature support compared to legacy XPath and JSONPath expressions. Use legacy expressions only when maintaining existing integrations that depend on them, or if a required feature is unavailable in the Synapse Expression Language. Existing integrations that use legacy expressions continue to work. If you are already updating such an integration, you can consider moving it to the Synapse Expression Language for consistency across your projects. Document any use of legacy expressions, noting the reason for their inclusion and any limitations, to aid future maintenance and upgrades. Testing & quality best practices¶ Test Strategy & Planning: Define a comprehensive test strategy for each project, outlining what needs to be tested, including functional, integration, performance, and security aspects. Test Plan Creation: Develop detailed test plans covering all functional scenarios, edge cases, and performance requirements. Include both positive and negative test cases. WSO2 MI: Integrator Unit Testing: WSO2 Integrator: MI offers built-in support for unit testing mediation sequences. Develop unit tests for your integrations to validate individual mediation logic, catch errors early, and ensure ongoing quality as your integration evolves. Automation Tools: Use JMeter and SoapUI for API and integration testing. Write automation scripts for repetitive test cases and performance tests. For web applications, automate UI testing using Selenium. Java Integration Tests: Whenever possible, implement Java-based integration tests to automate end-to-end scenarios and validate interactions between components. Isolated & Integrated Testing: Isolate test scenarios for each product or module. Test them as separate units before writing integration tests that cover cross-product or cross-module flows. Continuous Testing in SDLC: Perform tests throughout the Software Development Life Cycle (SDLC), from development to deployment, to catch issues early and ensure ongoing quality. Test Environment Parity: Ensure the test environment closely matches the production environment in terms of resource allocation, VM sizes, database configurations, and network resources. Distributed Testing: Avoid relying solely on single-node test results. Test across multiple nodes to simulate real-world deployment scenarios. Custom Solutions Testing: Test all custom solutions and artifacts thoroughly. Avoid using default server ports when testing custom features to prevent conflicts. Load & Performance Testing: Before production deployment, run load tests in development and test environments using data and scenarios that closely replicate production use cases. Security & Penetration Testing: Conduct penetration tests on the production setup before go-live. Coordinate with stakeholders to schedule and execute these tests. User Acceptance Testing (UAT): Run UAT rounds against documented requirements to ensure the solution meets customer acceptance criteria and business needs. Test Documentation: Document all functional and performance test results in detail. For each test, create a report that includes the steps followed, sample data or requests used, and the outcome (pass/fail, observations, and any issues found). Functional Test Results: Maintain a dedicated document for functional test results. Include test case descriptions, expected outcomes, actual outcomes, and any deviations or bugs identified during testing. Test Case ID Enter Function Name Description Enter Description Test Steps Enter Test Steps Expected Results Enter Expected Results Actual Results Enter Actual Results Status Enter Status (Pass/Fail) Comments Enter Comments Performance Test Results: Create a separate document for performance test results. Record the test scenarios, load profiles, metrics collected (such as response times, throughput, resource usage), and analysis of the results. Test Case ID Enter Test Case ID Description Enter Description Test Steps Enter Test Steps Actual Results Enter Actual Results Expected Results Enter Expected Results CPU Usage Enter CPU Usage Duration Enter Duration Memory Usage Enter Memory Usage Status Enter Status (Pass/Fail) Comments Enter Comments Test Summary Report: Prepare a summary document that aggregates all test results. Include the total number of test cases executed, breakdown of passed/failed cases, key observations, and a concise summary of overall system quality and readiness. Traceability: Link each test result to the corresponding requirement or user story to ensure traceability and coverage. Review & Sign-off: Share the test result documents and summary with stakeholders for review and sign-off before proceeding to deployment. Deployment Best Practices¶ Before deploying to production, optimize your deployment environment based on WSO2 MI performance recommendations. Review and implement the production deployment guidelines to ensure scalability, reliability, and security. Adjust resource allocations, configure JVM parameters, and fine-tune network and storage settings as outlined in the official documentation. Pre-testing Patches: Always test patches in a dedicated test environment before applying them to production. This helps identify potential issues and ensures compatibility with your integration solutions. Automated Patch Testing: Use automated test suites such as JMeter or SoapUI to validate the stability and functionality of patched environments. Automate regression and integration tests to quickly detect any breaking changes. Patch Documentation: Document all patches applied, including version details, test results, and any issues encountered during testing. Maintain a changelog for traceability and future reference. Scheduled Patch Cycles: Establish a regular patching schedule and communicate planned maintenance windows to stakeholders. Avoid applying patches during peak business hours to minimize disruption. Rollback Strategy: Prepare a rollback plan in case a patch introduces unexpected issues. Ensure backups and previous versions are available for quick restoration. Security Patches: Prioritize security patches and apply them promptly to mitigate vulnerabilities. Validate security fixes through targeted penetration and vulnerability tests in the test environment. Security Best Practices¶ Use WSO2 Secret Vault to securely store and manage sensitive information such as API keys, passwords, and certificates in your integration solutions. This approach ensures that secrets are encrypted at rest and only decrypted at runtime, reducing the risk of unauthorized access and enhancing overall security compliance. Using New Mediators in Existing Integrations¶ No changes are required for existing integrations Integrations built with earlier versions of WSO2 Integrator: MI (prior to 4.4.0) continue to work in newer versions. Existing mediators and configurations remain supported, so you do not need to modify integrations that are working as expected. Newer versions of WSO2 Integrator: MI provide mediators and connectors that offer a simpler development experience, such as the HTTP Connector, the ForEach Mediator with new syntax, the Scatter Gather Mediator, the Variable mediator and templating support in the PayloadFactory Mediator and Log Mediator. Consider using them when you build new integrations. Updating an existing integration to use them is optional. If you want to get the same benefits in an existing integration, for example, when you are already making changes to it, use the following guidelines. Each guideline includes a sample that shows how an existing configuration can be updated using the newer mediators. Test the updated integration thoroughly before you deploy it. From version 4.4.0 onwards, the MI for VS Code extension does not create an Out Sequence by default in APIs and proxy services. Instead, implement the logic that handles the response in the In Sequence. Existing APIs and proxy services that use an Out Sequence continue to work. Sample: Handling the response in the In SequenceExisting ConfigurationUpdated Configuration <api context="/weather" name="WeatherAPI" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="GET" uri-template="/?city={city}"> <inSequence> <payloadFactory media-type="json" template-type="default"> <format>{city: "$1", "apiKey": "$2"}</format> <args> <arg value="get-property('query.param.city')" evaluator="xml" /> <arg value="wso2:vault-lookup('weather_api_key')" evaluator="xml" /> </args> </payloadFactory> <send> <endpoint key="WeatherAPI"/> </send> </inSequence> <outSequence> <respond/> </outSequence> <faultSequence/> </resource> </api> <api context="/weather" name="WeatherAPI" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="GET" uri-template="/?city={city}"> <inSequence> <payloadFactory media-type="json" template-type="default"> <format>{city: "$1", "apiKey": "$2"}</format> <args> <arg value="get-property('query.param.city')" evaluator="xml" /> <arg value="wso2:vault-lookup('weather_api_key')" evaluator="xml" /> </args> </payloadFactory> <http.post configKey="WeatherAPIConnection"> <relativePath></relativePath> <headers>[]</headers> <requestBodyType>JSON</requestBodyType> <requestBodyJson>${payload}</requestBodyJson> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <forcePostPutNobody>false</forcePostPutNobody> <responseVariable>http_post_1</responseVariable> <overwriteBody>true</overwriteBody> </http.post> <respond/> </inSequence> <faultSequence/> </resource> </api> When you handle the response in the In Sequence, you do not need the Loopback Mediator, which moves a message from the In Sequence to the Out Sequence. To invoke external HTTP services in a non-blocking manner, you can use the HTTP Connector instead of the Call Mediator or Send Mediator with an endpoint. The HTTP Connector provides a simpler development experience. For blocking HTTP calls, continue using the Call Mediator in blocking mode or the Callout Mediator. For non-HTTP protocols such as VFS, RabbitMQ, and JMS, or scenarios where a connector is not applicable, continue using the Call Mediator. Sample: Using the HTTP Connector instead of the Call or Send mediator with an endpoint The HTTP Connector exposes built‑in configuration options that replace many values previously set using the Property mediator. Set these options on the connector operation itself (for example: headers, noKeepAlive etc.), since applying them via Property mediators for HTTP connector is not supported. The following sample shows how the same integration can be written with the new mediators. Existing ConfigurationUpdated Configuration <api context="/weather" name="WeatherAPI" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="GET"> <inSequence> <property name="NO_KEEPALIVE" value="true" scope="axis2"/> <call> <endpoint key="WeatherEndpoint"/> </call> </inSequence> <faultSequence/> </resource> </api> <endpoint name="WeatherEndpoint" xmlns="http://ws.apache.org/ns/synapse"> <http method="get" uri-template="http://weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London"> <suspendOnFailure> <initialDuration>-1</initialDuration> <progressionFactor>1</progressionFactor> </suspendOnFailure> <markForSuspension> <retriesBeforeSuspension>0</retriesBeforeSuspension> </markForSuspension> </http> </endpoint> <api context="/weather" name="WeatherAPI" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="GET"> <inSequence> <http.get configKey="WeatherAPIConnection"> <relativePath>/</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>true</noKeepAlive> <responseVariable>http_get_1</responseVariable> <overwriteBody>true</overwriteBody> </http.get> <respond /> </inSequence> <faultSequence/> </resource> </api> <localEntry key="WeatherAPIConnection" xmlns="http://ws.apache.org/ns/synapse"> <http.init> <connectionType>HTTP</connectionType> <baseUrl>http://weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London</baseUrl> <authType>None</authType> <timeoutAction>Never</timeoutAction> <retryCount>0</retryCount> <retryDelay>0</retryDelay> <suspendInitialDuration>-1</suspendInitialDuration> <suspendProgressionFactor>1</suspendProgressionFactor> <name>WeatherAPIConnection</name> </http.init> </localEntry> You can use the ForEach Mediator in place of the Iterate Mediator. It supports parallel execution, enables external service calls, and offers more flexible configuration. Sample: Using the ForEach mediator instead of the Iterate mediatorMap Iterate mediator attributes to new ForEach mediator equivalents as follows: Iterate attribute / element Foreach attribute / element mapping Notes id="123" Not needed anymore. expression="json-eval($.)" collection="${payload}" Convert JSONPath/XPath evaluated expression to Synapse expression referencing the iteration collection. sequential="true|false" parallel-execution="true|false" Map sequential to parallel-execution (set parallel-execution="true" when sequential="false" to enable concurrent processing; set parallel-execution="false" when sequential="true" to preserve ordering). continueParent="true|false" N/A This is not applicable as all iterations are aggregated in the foreach mediator itself. preservePayload="true|false" update-original="true|false" For details on output aggregation and related options, see ForEach mediator output configurations. attachPath="true|false" N/A Attach path is no longer supported. Please use Enrich mediator after the foreach mediator. The following sample shows how the same integration can be written with the new mediators. Existing ConfigurationUpdated Configuration <iterate expression="json-eval($.)"> <target> <sequence> <call> <endpoint key="PlaceOrderEndpoint"/> </call> </sequence> </target> </iterate> <endpoint name="PlaceOrderEndpoint" xmlns="http://ws.apache.org/ns/synapse"> <http method="get" uri-template="http://localhost:8290/orderapi/placeOrder"> <suspendOnFailure> <initialDuration>-1</initialDuration> <progressionFactor>1</progressionFactor> </suspendOnFailure> <markForSuspension> <retriesBeforeSuspension>0</retriesBeforeSuspension> </markForSuspension> </http> </endpoint> <foreach collection="${payload}" parallel-execution="false" update-original="true" continue-without-aggregation="false"> <sequence> <http.get configKey="OrderAPIConnection"> <relativePath>/placeOrder</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <responseVariable>http_get_1</responseVariable> <overwriteBody>true</overwriteBody> </http.get> </sequence> </foreach> <localEntry key="OrderAPIConnection" xmlns="http://ws.apache.org/ns/synapse"> <http.init> <connectionType>HTTP</connectionType> <baseUrl>http://localhost:8290/orderapi</baseUrl> <authType>None</authType> <timeoutAction>Never</timeoutAction> <retryCount>0</retryCount> <retryDelay>0</retryDelay> <suspendInitialDuration>-1</suspendInitialDuration> <suspendProgressionFactor>1</suspendProgressionFactor> <name>OrderAPIConnection</name> </http.init> </localEntry> The ForEach Mediator has a new configuration that you can use instead of the earlier ForEach configuration. With the new configuration, you can: Select the collection to iterate over using a Synapse expression (collection) instead of a JSONPath or XPath expression. Process iterations in parallel (parallel-execution). Call external services within the iteration. Choose whether to update the original message with the result of the iterations (update-original). Sample: Using the new ForEach mediator instead of the earlier ForEach mediator Existing attribute / element New attribute / element Notes id="123" Not needed anymore. The current iteration number can be accessed using a variable in the new foreach mediator. expression="json-eval($.items)" collection="${payload.items}" Convert JSONPath/XPath evaluated expression to Synapse expression referencing the iteration collection. N/A parallel-execution="false|true" Set parallel-execution="false" when updating from an existing sequential processing configuration. N/A continue-without-aggregation="false|true" Set continue-without-aggregation="true" to maintain the existing behavior. N/A update-original="true|false" Set update-original="false" to maintain the existing behavior. The following sample shows how the same integration can be written with the new mediators. Existing ConfigurationUpdated Configuration <foreach expression="json-eval($.)"> <sequence> <payloadFactory media-type="json" template-type="default"> <format>{ "id": "$1", "count": "$2" }</format> <args> <arg expression="json-eval($.id)" evaluator="json"/> <arg expression="json-eval($.count)" evaluator="json"/> </args> </payloadFactory> </sequence> </foreach> <foreach collection="${payload}" parallel-execution="false" update-original="false" continue-without-aggregation="true"> <sequence> <payloadFactory media-type="json" template-type="default"> <format>{ "id": "${payload.id}", "count": "${payload.count}" }</format> </payloadFactory> </sequence> </foreach> You can use the Scatter Gather Mediator in place of the combination of the Clone Mediator and the Aggregate Mediator to send a message to multiple targets and aggregate the responses using a single mediator. Sample: Using the Scatter Gather mediator instead of the Clone and Aggregate mediatorsThe Scatter Gather mediator replaces the need for separate Clone and Aggregate mediators. The table below maps Clone mediator attributes to their corresponding Scatter Gather mediator attributes. Clone mediator attribute Scatter Gather mediator attribute Notes id="123" N/A This is not applicable as the cloned message responses are aggregated in the Scatter Gather mediator itself. sequential="true|false" parallel-execution="true|false" Set parallel-execution="false" when updating from an existing sequential processing configuration. continueParent="true|false" N/A This is not applicable as all cloned messages are aggregated in the Scatter Gather mediator itself. The table below maps Aggregate mediator attributes to their corresponding Scatter Gather mediator attributes. Aggregate mediator attribute Scatter Gather mediator attribute Notes id="123" N/A Scatter Gather mediator aggregates responses internally, so an explicit id for aggregation is unnecessary. <onComplete expression="json-eval($)" /> <aggregation expression="${payload}"> Convert JSONPath/XPath evaluated expression to Synapse expression. timeout timeout Message Count: min min-messages Message Count: max max-messages <correlateOn expression="xpath | json-eval(JSON-Path)" /> condition="expression" Convert JSONPath/XPath evaluated expression to Synapse expression. The following sample shows how the same integration can be written with the new mediators. Existing ConfigurationUpdated Configuration <clone> <target> <sequence> <call> <endpoint key="vendorA"/> </call> </sequence> </target> <target> <sequence> <call> <endpoint key="vendorB"/> </call> </sequence> </target> </clone> <aggregate> <completeCondition> <messageCount max="-1" min="-1"/> </completeCondition> <onComplete aggregateElementType="root" expression="json-eval($)"> <enrich description=""> <source clone="true" type="custom" xpath="$body//jsonArray/jsonElement[not(last > $body//jsonArray/jsonElement/last)]"/> <target action="replace" type="property" property="enrichedres"/> </enrich> <payloadFactory media-type="json"> <format>$1</format> <args> <arg expression="get-property('enrichedres')" evaluator="xml"/> </args> </payloadFactory> <respond/> </onComplete> </aggregate> <scatter-gather parallel-execution="false" target="Body" result-content-type="JSON"> <aggregation expression="${payload}"/> <sequence> <http.get configKey="VendorA_Connection"> <relativePath>/getQuote</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <responseVariable>http_get_1</responseVariable> <overwriteBody>true</overwriteBody> </http.get> </sequence> <sequence> <http.get configKey="VendorB_Connection"> <relativePath>/getQuote</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <responseVariable>http_get_1</responseVariable> <overwriteBody>true</overwriteBody> </http.get> </sequence> </scatter-gather> <payloadFactory media-type="json" template-type="default"> <format xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">${xpath("$body//jsonArray/jsonElement[not(last > $body//jsonArray/jsonElement/last)]")}</format> </payloadFactory> <respond/> You can use the templating support in the PayloadFactory Mediator to build payloads with inline expressions. Sample: Using templating in the PayloadFactory mediatorThe PayloadFactory mediator supports inline templating. You can insert Synapse expressions directly in the format string (for example, ${props.synapse.id}) instead of using the <args> block and the $1, $2 placeholders. This simplifies templates and improves readability. The following sample shows how the same integration can be written with the templated support. Existing ConfigurationUpdated Configuration <payloadFactory media-type="json" template-type="default"> <format>{ "id": "$1", "count": "$2" }</format> <args> <arg expression="$ctx:id" evaluator="xml"/> <arg expression="$ctx:count" evaluator="xml"/> </args> </payloadFactory> <payloadFactory media-type="json" template-type="default"> <format>{ "id": "${props.synapse.id}", "count": "${props.synapse.count}" }</format> </payloadFactory> You can use the templating support in the Log Mediator to define log messages with inline expressions. Sample: Using templating in the Log mediatorThe new Log mediator configuration does not use the level attribute. Instead, use the logMessageID and logFullPayload attributes to select the details to log. For example, set logFullPayload="true" to log the full payload, as level="full" did. You can define the log message as a template in the <message> element by inserting Synapse expressions directly in it. The following sample shows how the same integration can be written with the templated support. Existing ConfigurationUpdated Configuration <log category="INFO" level="simple"> <property name="Name" expression="$ctx:name"/> </log> <log category="INFO" logMessageID="true" logFullPayload="false"> <message>Name: ${props.synapse.name}</message> </log>