Friday, October 28, 2016

MMC Repository

I had hosted MMC on tomcat using Linux user "esb".

For every deployment repository will get created and will be stored under "/home/esb/mmc-data".
So need to clean up repository regularly so save space. While cleaning up repository from MMC need to clean older version , if you delete current version from repository app will get undeployed and removed from MMC.

Thursday, October 27, 2016

Importing Java Libraries in DataWeave and MEL

Last but not least, we are going to define a global function that imports different libraries and can be used via DataWeave, isn’t this cool! :-)
First of all, we need to define our global function. In this example we are going to calculate the number of days of one month provided as a parameter. We will make use of Calendar and SimpleDateFormat libraries.
<configuration doc:name="Configuration">
  <expression-language>
      <global-functions>
          def dayOfTheMonth(date){
          
              import java.util.Calendar;
              import java.text.SimpleDateFormat;
              
              cal = Calendar.getInstance();
              sdf = new SimpleDateFormat('yyyyMMdd');
              cal.setTime(sdf.parse(date));
              
              return cal.getActualMaximum(Calendar.DAY_OF_MONTH).toString();
          }
      </global-functions>
  </expression-language>
</configuration>

Our new function is ready to be used! We can now use a MEL expression or include our function in Dataweave!
MEL:   #[dayOfTheMonth(‘20151027’)]
DataWeave:   day: dayOfTheMonth(‘20140302’)