Posts

Showing posts with the label Mule4

Mulesoft -- Persistent Queues, Batch Job Queues, Object Store V2(OSV2) , Persistent Object Store, Non-Persistent Object Store in CloudHub 1.0

  In MuleSoft CloudHub 1.0, persistent queues and batch job queues are mechanisms to ensure reliable message processing and handle large datasets asynchronously. They are stored and managed differently but work together to provide scalability and reliability . Persistent Queues : Persistent queues in CloudHub 1.0 are used for reliable message delivery across Mule applications, particularly for VM (Virtual Machine) connectors or when distributing workloads across multiple workers. They are backed by CloudHub’s Cloud Queue Storage (CQS) , which uses Amazon SQS under the hood for persistence. When enabled in the Anypoint Runtime Manager (via the "Persistent Queues" checkbox) , all VM queues in the application are stored persistently in CQS, overriding any transient queue settings in the Mule configuration. Data in persistent queues is stored in the same region as the worker (e.g., AWS SQS in the deployed region) and survives worker restarts or crashes, ensuring zero mes...

Mulesoft- Appropriate interface/data technology and interface definition language for all integration interfaces - soap ,rest and file

  SOAP (Simple Object Access Protocol) SOAP is a protocol for exchanging structured information in a platform-independent manner, typically over HTTP, using XML. Transport : HTTP/HTTPS (most common), SMTP, or TCP for specific use cases. Data Format : XML (mandatory for SOAP messages). REST (Representational State Transfer) REST is an architectural style for designing networked applications, relying on stateless, client-server communication, typically over HTTP. Transport : HTTP/HTTPS. Data Format : JSON (most common due to its lightweight nature), XML, or plain text. File-Based Integration File-based integration involves exchanging data via files (e.g., CSV, JSON, XML) over protocols like FTP, SFTP, or shared file systems. Transport : FTP/SFTP for secure file transfer. Data Format : CSV: For tabular data, widely supported but lacks schema enforcement. JSON: For structured, hierarchical data, lightweight and flexible. XML: For complex, schema-driven data, common in legacy sys...

Mulesoft Integration - Limitations of Using an External Identity Provider in MuleSoft

  In MuleSoft’s Anypoint Platform, using an external identity provider (IdP) for authentication and authorization integrates with single sign-on (SSO) protocols like SAML 2.0, OpenID Connect (OIDC), or LDAP to manage user access. While this offers flexibility and centralized identity management, there are several limitations and considerations to be aware of when configuring an external IdP. Below is a comprehensive overview based on MuleSoft’s documentation and best practices: 1. Supported Protocols 2.  Configuration Complexity 3. User Provisioning 4. Role and Permission Limitations 5. Session Management 6. Federation Scope 7. Feature Limitations 8. Dependency on IdP Availability 9. Platform-Specific Constraints 10. Support and Troubleshooting Best Practices to Mitigate Limitations Validate IdP Compatibility : Ensure your IdP supports SAML 2.0 or OIDC and can provide required attributes (e.g., email, NameID, or groups). Pre-Provision Users : Invite users to Anypoint Platfo...

Mulesoft Integration - Options to Connect OnPrem with CloudHub VPC

  To connect an on-premises network to a Virtual Private Cloud (VPC) in MuleSoft’s Anypoint Platform, you can use several methods to establish a secure and efficient connection. 1. IPsec VPN Tunnel (Recommended for Most Scenarios) 2. AWS Direct Connect 3. VPC Peering 4. Transit Gateway Attachment Recommended Approach For most organizations, an IPsec VPN tunnel is the preferred method due to its simplicity, compatibility with existing infrastructure, and robust security. If your organization requires high-speed, low-latency connections and already uses AWS, consider AWS Direct Connect or VPC peering . For complex multi-VPC or multi-data-center setups, a Transit Gateway provides the most flexibility.

Mulesoft Integration - VM (Virtual Machine) Connector

 W hen to use VM Connector and when not to use in Mule4 VM (Virtual Machine) connector is used for asynchronous, intra-application message passing within a Mule application or across Mule applications running on the same Mule runtime . It provides a lightweight, in-memory queuing mechanism to decouple components, improve performance, and manage workflows. However, it’s not always the best choice for every scenario. Below is a detailed guide on when to use the VM connector and when not to use it in Mule 4 When to Use the VM Connector Asynchronous Processing Intra-Application Communication: Inter-Application Communication on the Same Runtime Load Balancing and Scalability Temporary Storage for Retries or Error Handling Message Persistence with Persistent Queues: Simplified Integration Testing When Not to Use the VM Connector Cross-Runtime Communication High-Volume or Enterprise-Grade Messaging Complex Message Routing or Transformation Long-Term Message Storage External System Integr...

Mule4 - Dataweave - use of read, fromBase64, valuesOf

Image
 Scenario: Assuming that there is base64 encoded string containing values separated by tab(\t) and each row is separated by new line(\n) without any headers, how to extract and build json with predefined index mapped to particular attribute name. Lets assume 0 index is firstName, 1st Index is lastName 2nd Index is customerId. Sample Data:   Mule\t Soft\t aa234ed23e Lets encode the above data to base64: TXVsZVx0U29mdFx0YWEyMzRlZDIzZQ== Now using dataweave functions read, fromBase64 and valueOf ,  extract and build json.

DB Update Statement with In Clause in Mulesoft

Image
 Here we will look at how Update SQL query with IN clause can be constructed when there are multiple values coming as array as IN clause input Assuming that dateSent must be updated for all the eventIds sent as input using IN clause. Input: { "dateUpdated" : "2025-01-14" , "eventId" : [ "234er-4356" , "234er-4896" , "4dse4-4321" ] } Building Update SQL in Dataweave %dw 2.0 output application/json --- { "dynamicUpdateStatement" : "Update table_name set dateSent='" ++ payload . dateUpdated ++ "' where eventId in (" ++ "'" ++ (payload . eventId joinBy( "','" ) ++ ")" ) } Output: { "dynamicUpdateStatement" : "Update table_name set dateSent='2025-01-14' where eventId in ('234er-4356','234er-4896','4dse4=4321')" } Screenshot: Another Solution: Dataweave: %dw 2.0 output application/json ---...

RAML with MultiPart

 Lets build to build file upload with MultiPart, below is RAML RAML /testUpload:      post:        description:  file upload to sftp        headers:         f ilePath:            description:  sftp file path            type:  string        body:          multipart/form-data:            properties:              fileName:                description:  file name                type:  string  ...

Dataweave 2.0 update function

Image
  Update the user data below. Usernames should be all lower case and the street should be   "Fiskargatan" (example from dataweave tutorial from mulesoft) Input payload { "username": "WASP", "name": "Lisbeth", "surname": "Salander", "location": { "address": { "street": "Lundagatan", "number": 9 }, "city": "Stockholm", "country": "Sweden" } } Dataweave Transformation %dw 2.0 import * from dw :: util :: Values output json --- payload update "username" with lower($) update [ "location" , "address" , field( "street" )] with "Fiskargatan" output { "username" : "wasp" , "name" : "Lisbeth" , "surname" : "Salander" , "location" : { "address...

Dataweave 2.0 - Pluck

Image
 Pluck is useful converting HashMap/Object into array of Objects.  pluck  iterates over an object and returns an array of keys, values, or indices from the object.

Dataweave 2.0(2.7) - typeOf

Image
 How to determine if the variable or payload type is String, Array, Number , Boolean or Object  using typeOf Object: String Number: Boolean: Array:

Mule4 - Resolving Database Date and DateTime Type Error while Inserting.

Let's see how to resolve error while inserting database date and datatime errors in Mule4 while inserting data into database. Column Declared as Date in database for the table example as follows: TRANDATE DATE DEFAULT '1970-01-01' NOT NULL, Dataweave : ( assuming the incoming  billing_date is coming as DateTime( example: "2024-02-06T11:02:05.237Z") and converting to Date in String format "yyyy-MM-dd" %dw 2.0 output application/json --- "billing_date": $.billing_date as DateTime {format: "yyyy-MM-dd'T'HH:mm:ss.SSSX"} as String {format : "yyyy-MM-dd"} , to convert RAML datetime type DB date time %dw 2.0 output application/json --- "date_updated" : $.date_updated as DateTime {         format : "yyyy-MM-dd'T'HH:mm:ss.SSSX"     } as DateTime {         format : "yyyy-MM-dd HH:mm:ss"     } error while executing :  "reason": "DB:QUERY_EXECUTION", "message...

Mulesoft Certified Developer-Level2 - Study Material

Image
My Study Notes for Salesforce Certified Mulesoft Developer - Level2. Go thru chapter wise (DataSheet) reference links for each topic provided below and make notes for quick reference. Take Mulesoft Certified Developer Level2 Practice test provided by MuleSoft training as many times as possible @    https://training.mulesoft.com/certification/developer-mule4-level2/practice-exam   MCD Level2 - DataSheet Ch1:Expose production-ready Anypoint Platform managed APIs from Mule applications  https://help.mulesoft.com/s/question/0D52T00004mXYC6SAO/horizontal-scaling-vs-vertical-scaling-of-mule-workers Implement versioning of specific API-related artifacts https://docs.mulesoft.com/exchange/to-change-raml-version https://forum.raml.org/t/as-versions-is-managed-in-raml/788/3   Configure custom or out-of-the-box (OOTB) API policies https://docs.mulesoft.com/gateway/policies-included-http-caching https://docs.mulesoft.com/api-manager/1.x/json...