Wednesday, April 24, 2019

Sorting in Mule 4

Sorting the data can be done using dataweave in Mule 4 with orderBy function.

orderBy: Reorders the content of an object using a value returned by a function as the criteria.

Sorting Numbers: In Mule 4 using dataweave.

Ascending order: To sort the numbers in ascending order, use 'orderBy $'.
Example: numberAsc: ([3,8,1,6] orderBy $)

Descending order: To sort the numbers in descending order, use 'orderBy -$'.
Example: numberDesc: ([3,8,1,6] orderBy -$)

Sorting Letters: In Mule 4  using dataweave.

Ascending order: To sort the letters in ascending order, use 'orderBy $' just like in case of sorting the numbers.
Example: letterAsc: (["s","e","p","z","a"] orderBy $)

Descending order: To sort the letters in descending order, there is an extra logic to be used. Arrange the letters in ascending order using 'orderBy $' and on top of that, use '[-1 to 0]', which inverts the ascending order thereby giving the descending order of letters.
Example: letterDesc: (["s","e","p","z","a"] orderBy $)[-1 to 0]

Complete code snippet:
Input Dataweave logic:


Output:

Please feel free to comment your queries/opinions.

Friday, April 5, 2019

Issues in Mule 4

Munit Debug Error


  • Currently the recommended version of runtime in Mule 4 is 4.1.5.
When we create Munit for our Mule 4 applications and try to run the test cases in debug mode,  we have an issue at times.

 

One of the solution for this is :
1. Copy the files from "C:\Users\{username}\.m2\repository\com\mulesoft\mule\agent\mule-debugger\4.1.4"
2. Paste them to "C:\Users\{username}\.m2\repository\com\mulesoft\mule\agent\mule-debugger\4.1.5" and rename file from 4.1.4 to 4.1.5


This should solve your problem.

Mule 4

Introduction

  • Mule 4 comes with the Anypoint Studio version 7, in simple Studio 7.
  • In Mule 4, we have Dataweave Language which replaced Mule Expression Language(MEL).
  • Try scope is added for the error handling which helps in handling easily.
  • Dataweave has been changed to 2.0.
  • Minor changes to Munit, which is easy to use now.
  • In mule 4, the code by default is a mavenised code. There is no need of manually mavenising as in case of Mule 3.
  • With Mule 4, it is now easy to build/develop the applications.

Will be adding more in detail with common issues faced in Mule 4.

TIBCO EMS :

TIBCO EMS :  TIBCO Enterprise Message Service™, our standards-based Java™ Message Service (JMS) broker allows any application that suppor...