Monday, October 15, 2018

SOAP service in mule



when we want to consume soap from HTTP/postman below is the way


in the above you can see that header "SOAPAction" will help in routing to specific flow implementation.

flow name should be same as <<operationName>>:<<soapApiKit routerName>>

Saturday, July 7, 2018

mule details

Exception exception = (Exception)message.getExceptionPayload().getException();

This give ExceptionPaylaod object whose getException() method provides the exception object.

To get the stack trace use the following.

StackTraceElement[] ste = exception.getCause().getStackTrace();

in studio in muleProject.xml under environment variables use mule.stacktrace.full=true to get stack trace


Srinivas_Ganta01@infosys.com

Kalyan_Vetcha@infosys.com

Srinivas Ganta01 Srinivas_Ganta01@infosys.com – servicenow

http://www.whishworks.com/blog/mule-esb/integrating-mulesoft-with-servicenow-incident-management-system/



https://docs.mulesoft.com/mule-user-guide/v/3.7/http-connector


service now -----
user : Sandeep_teerth@infosys.com
paswd: Incredible@9

https://dev17712.service-now.com/navpage.do  - service now instance
user:admin
pasd: Incredible@9

https://akaash.infosys.com/#Workspaces/VMExtension/VM/698ca788-7107-428d-8435-8df7c50a09be/VMDashboard


http://activemq.apache.org/activemq-5132-release.html

mule links

flowVars – contains variables that are global to the current flow. They retain their values as control passes from one message processor to another. Thus, you can set them in one message processor and use them in another.
sessionVars – is essentially the same as flowVars, except that when one flow calls another one via a Mule endpoint they are propagated.



https://docs.mulesoft.com/mule-user-guide/v/3.7/hardware-and-software-requirements



DATAWEAVE
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-examples

http://www.mulesoft.org/documentation/display/current/File+Transport+Reference
http://training.mulesoft.com
http://mulesoft-training.com/dm-plugin.zip
https://docs.mulesoft.com/mule-user-guide/v/3.8/dataweave-types
https://docs.mulesoft.com/mule-user-guide/v/3.8/dataweave-formats
https://docs.mulesoft.com/mule-user-guide/v/3.8/dataweave-language-introduction

HOW TO LOOP ON HASHMAP IN DATWEAVE ANF GET BOTH KEY AND VALUE IN

flowVars.mapVal = new HashMap();
mapVal.put('a',123);
mapVal.put('b',987);
flowVars.listVal = new ArrayList(flowVars.mapVal.entrySet());

%dw 1.0
%output application/json
---
{
specification: flowVars.listVal map ((payload01 , indexOfPayload01) -> {
name: payload01.key,
value: payload01.value
})
}


MEL Mule Expression
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-reference - MEL good
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-examples - MEL
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-mel
https://docs.mulesoft.com/mule-fundamentals/v/3.6/mule-message-tutorial

https://docs.mulesoft.com/mule-user-guide/v/3.7/mel-cheat-sheet
https://docs.mulesoft.com/mule-user-guide/v/3.7/mule-expression-language-tips

https://docs.mulesoft.com/mule-fundamentals/v/3.7/flows-and-subflows

https://docs.mulesoft.com/mule-user-guide/v/3.7/xpath
https://docs.mulesoft.com/mule-user-guide/v/3.7/developing-components  - entry point resolver set

https://docs.mulesoft.com/mule-user-guide/v/3.7/schema-validation-filter
http://stackoverflow.com/questions/23081016/mule-how-to-get-mule-to-throw-an-exception-if-xml-schema-validation-fails

https://docs.mulesoft.com/mule-user-guide/v/3.7/servicenow-connector-5.0
https://www.youtube.com/watch?v=NaqHoOn0sEQ – service now demo

define variable  name : varlist   value:#[[]]   , so now varlist will act as list we can add values to this list

#[java.lang.Thread.currentThread().getId()]
muleContext.registry.lookupFlowConstruct('<flowname>').start();
muleContext.registry.lookupFlowConstruct('<flowname>').stop();

flowVars.varlist.add('value')

------------------------------------------------------------------------------------------------------------------------------
DATE
#[new org.mule.el.datetime.DateTime('2016-12-13T08:15:30-05:00').format("dd-MM-yyyy")]

flowVars.date = new org.mule.el.datetime.DateTime('2017-08-20' , 'yyyy-MM-dd');
date.format('dd-MM-yyyy') - to format the date

flowVars.lastMatChangeSapDate.isAfter(flowVars.lastExtractionDate) - to comare 2 dates in mule

DATE in DATAWEAVE  TRASNFORMER
"2016-03-09"as :date {format:"yyyy-MM-dd"} < (now  as :date {format:"yyyy-MM-dd"})


--------------------------------------------------------------------------------------------------------------------------------
HTTP QUERY PARAM
[message.inboundProperties.'http.query.params'.get('param_name')]

  MuleMessage muleMessage = eventContext.getMessage();
     Map<String, String> queryParams = muleMessage.getInboundProperty("http.query.params");
         String name=queryParams.get("name");
         System.out.println(name);
         return muleMessage;

HTTP URI PARAMETERS
<when expression="#[regex('services/v1/users/.*', message.inboundProperties['http.relative.path'])]">

#[exception.event.flowConstruct.name]   is working to get the flow name in the set payload of exception block instead of hard-coding.

Mule MMC -- http://localhost:8585/mmc-3.7.0.

https://docs.mulesoft.com/mule-management-console/v/3.7/installing-the-production-version-of-mmc
https://docs.mulesoft.com/mule-management-console/v/3.7/installing-the-trial-version-of-mmc
https://docs.mulesoft.com/mule-management-console/v/3.4/troubleshooting-tips

https://docs.mulesoft.com/mule-user-guide/v/3.7/downloading-and-starting-mule-esb

MQ
http://olex.openlogic.com/packages/activemq/5.9.1#package_detail_tabs - active mq
http://blogs.mulesoft.com/dev/newbie/mule-school-jms-tutorial/ --active mq integrate with mule  --  http://activemq.apache.org/activemq-5132-release.html
http://activemq.apache.org/download.html -- to get lib to connect active mq
http://10.66.56.52:8161/admin/  - mq admin


http://stackoverflow.com/questions/30099083/how-to-set-flow-variables-inside-expression-component-in-mule


META DATA

https://docs.mulesoft.com/mule-user-guide/v/3.7/custom-metadata-tab
https://docs.mulesoft.com/mule-user-guide/v/3.7/defining-metadata-using-edit-fields

MULE MODULE REQUESTOR
https://github.com/mulesoft/mule-module-requester
https://repository-master.mulesoft.org/nexus/content/repositories/releases/org/mule/modules/mule-module-requester/1.3/mule-module-requester-1.3-studio-plugin.zip
https://github.com/mulesoft/mule-module-requester/blob/master/mulerequesterdemo/src/main/app/MuleRequesterDemo.xml
http://blogs.mulesoft.com/dev/mule-dev/introducing-the-mule-requester-module/

API DESIGN STEP BY STEP
https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-intro-create

https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-design-new
https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-build
https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-design-existing

BATCH JOB
http://blogs.mulesoft.com/dev/tech-ramblings/batch-module-obtaining-the-job-instance-id-in-mule-3-7/

TIMER BASED TRIGGER
http://www.dotnetfunda.com/articles/show/2151/scheduling-a-job-in-mule-using-cron-expression

https://docs.mulesoft.com/mule-user-guide/v/3.7/quartz-transport-reference
http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html
http://www.manpagez.com/man/5/crontab/


DATA WEAVE

https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-tutorial
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-examples
https://github.com/mulesoft/mulesoft-docs/blob/master/mule-user-guide/v/3.7/dataweave-reference-documentation.adoc

FOR EACH
https://docs.mulesoft.com/mule-user-guide/v/3.7/foreach
http://stackoverflow.com/questions/22773535/mule-accessing-counter-variable-from-component-inside-foreach
http://stackoverflow.com/questions/27725286/how-to-extract-values-from-an-xml-list-in-mule-foreach

continuous INTEGRATION
https://docs.mulesoft.com/mule-user-guide/v/3.7/continuous-integration

MAVEN

https://repository.mulesoft.org/releases/
http://repo1.maven.org/maven2/org/jfrog/maven/annomojo/maven-plugin-tools-anno/

https://docs.mulesoft.com/mule-user-guide/v/3.7/using-maven-with-mule
https://docs.mulesoft.com/mule-user-guide/v/3.7/building-a-mule-application-with-maven-in-studio
https://docs.mulesoft.com/mule-user-guide/v/3.7/maven-support-in-anypoint-studio

MAVEN PLUGIN

http://updates.jenkins-ci.org/download/plugins/maven-plugin/

http://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/plugins/maven-plugin/2.13/maven-plugin.hpi?bcsi_scan_ee7e30f120188340=1

http://10.68.123.4:8083/updateCenter/

ARM
https://docs.mulesoft.com/cloudhub/managing-applications-and-servers-in-the-cloud-and-on-premises
http://blogs.mulesoft.com/biz/mule/anypoint-runtime-manager-v1-2-monitoring-servers-and-apps-with-splunk-elk/
https://docs.mulesoft.com/cloudhub/sending-data-from-arm-to-external-monitoring-software#basic-architecture
https://docs.mulesoft.com/runtime-manager/sending-data-from-arm-to-external-monitoring-software

MUNIT
https://docs.mulesoft.com/munit/v/1.1.1/

MULE API GATE
https://docs.mulesoft.com/anypoint-platform-for-apis/install-studio-gw

JANSI java.lib.path
C:\Windows\System32\config\systemprofile\AppData\Local\Temp


https://docs.mulesoft.com/mule-agent/v/1.4.0/installing-mule-agent
https://docs.mulesoft.com/runtime-manager/managing-servers#start-mule-or-api-gateway
https://docs.mulesoft.com/anypoint-platform-for-apis/proxying-your-api
https://docs.mulesoft.com/anypoint-platform-for-apis/configuring-proxy-access-to-the-anypoint-platform-for-apis
https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-proxy
https://docs.mulesoft.com/runtime-manager/managing-servers#start-mule-or-api-gateway
https://www.mulesoft.com/ty/dl/api-gateway  - gateway dowload
https://www.mulesoft.com/ty/dl/mule
http://blogs.perficient.com/integrate/2016/04/01/connecting-mule-api-gateway-and-esb-in-hybrid-mode/

http://www.slideshare.net/RamakrishnaNarkedami/mule-integration-with-servicenow

XML TO JSON
http://www.utilities-online.info/xmltojson/#.V1Z-Trh97IU

SERVICE NOW
https://www.youtube.com/watch?v=hHxqTWXUqog

RAML RESPONSES
http://www.restapitutorial.com/httpstatuscodes.html
http://raml.org/developers/raml-200-tutorial
http://stackoverflow.com/questions/39996914/when-to-use-singular-or-plural-resource-names-in-raml

EXCEPTION
http://stackoverflow.com/questions/18611219/mule-error-handling
Exception exception = (Exception)message.getExceptionPayload().getException();
#[StackTraceElement[] ste = exception.getCause().getStackTrace();]

https://docs.mulesoft.com/mule-fundamentals/v/3.7/mule-message-structure

SHARE
https://docs.mulesoft.com/mule-user-guide/v/3.6/sharing-custom-configuration-fragments
https://docs.mulesoft.com/mule-user-guide/v/3.7/shared-resources
https://docs.mulesoft.com/mule-user-guide/v/3.5/modularizing-your-configuration-files-for-team-development
http://stackoverflow.com/questions/30442954/cant-get-a-mule-flow-reference-to-recognize-imported-resource-external-flow-f

DEPLOYMENT
https://docs.mulesoft.com/mule-management-console/v/3.7/
https://docs.mulesoft.com/mule-fundamentals/v/3.7/deploying-mule-applications
https://docs.mulesoft.com/mule-user-guide/v/3.7/deployment-scenarios
https://docs.mulesoft.com/mule-user-guide/v/3.7/application-deployment
https://docs.mulesoft.com/runtime-manager/cloudhub-and-mule
https://docs.mulesoft.com/runtime-manager/developing-a-cloudhub-application

WEB SERVICE
https://docs.mulesoft.com/mule-user-guide/v/3.7/building-web-services-with-cxf
https://www.youtube.com/results?search_query=develope+web+service+in+mule+using+cxf

REQUESTER
https://github.com/mulesoft/mule-module-requester

MMC-LDAP
https://docs.mulesoft.com/mule-management-console/v/3.7/setting-up-and-managing-users-via-ldap

http://www.programmableweb.com/news/standalone-raml-api-mocking-tools-surface/2015/08/13

INSTALLATION
https://docs.mulesoft.com/mule-management-console/v/3.8/installing-the-production-version-of-mmc
https://docs.mulesoft.com/mule-user-guide/v/3.8/installing-an-enterprise-license
https://docs.mulesoft.com/tcat-server/v/7.1.0/
https://docs.mulesoft.com/tcat-server/v/7.1.0/installing-tcat-server-on-linux

https://www.mulesoft.com/tcat/understanding-apache-tomcat
https://www.mulesoft.com/tcat/tomcat-60
https://www.mulesoft.com/tcat/tomcat-configuration



https://docs.mulesoft.com/mule-user-guide/v/3.8/starting-and-stopping-mule-esb


PROPERTY
<context:property-placeholder location="pollChange.properties" ignore-resource-not-found="true" />
https://docs.mulesoft.com/mule-user-guide/v/3.6/deploying-to-multiple-environments


TOMCAT
https://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/

WEB SERVICE CONSUMER
https://docs.mulesoft.com/mule-user-guide/v/3.7/web-service-consumer


https://docs.mulesoft.com/mule-user-guide/v/3.7/publishing-and-consuming-apis-with-

PUBLISHING SOAP API
https://docs.mulesoft.com/mule-user-guide/v/3.7/publishing-a-soap-api

ODATA
https://github.com/mulesoft/odata-connector
http://blogs.mulesoft.com/dev/anypoint-platform-dev/data-as-a-service-an-odata-primer/

DATAWEAVE
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation

FOR EACH ON XML
http://stackoverflow.com/questions/27725286/how-to-extract-values-from-an-xml-list-in-mule-foreach

ENTERPRISE SECURITY
https://docs.mulesoft.com/release-notes/anypoint-enterprise-security-release-notes

MMC Performance Tune
https://docs.mulesoft.com/mule-management-console/v/3.7/using-the-management-console-for-performance-tuning

DEFAULT THREAD HTTP
https://docs.mulesoft.com/mule-user-guide/v/3.8/http-listener-connector

TOMCAT
https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

MULE MAVEN - DOMAIN DEPLOY
https://docs.mulesoft.com/mule-user-guide/v/3.7/mule-maven-plugin

MMC ALERTS
https://docs.mulesoft.com/mule-management-console/v/3.7/defining-slas-and-alerts

MULE SCRIPTING
https://docs.mulesoft.com/mule-user-guide/v/3.7/scripting-module-reference#sts=Script%20Context%20Bindings

GROVY MULE FLOW STATUS
https://forums.mulesoft.com/questions/5552/create_mmc_alert_for_flow_status.html
http://stackoverflow.com/questions/26678285/how-to-find-out-mule-flow-status
https://docs.mulesoft.com/mule-user-guide/v/3.7/groovy-component-reference

AbstractFlowConstruct f = (AbstractFlowConstruct) muleContext.getRegistry().lookupFlowConstruct("flowName");       
    if (f.isStopped()){
        // start flow
    }
// it can also be used : f.isStarted()


API CURL
https://docs.mulesoft.com/mule-management-console/v/3.8/repository-of-applications

SET ENV IN RUNTIME
./mule start -M-Dcountry=UK
or
wrapper.java.additional.18=-Dcountry=UK

LOG FILE LOCATION CHANGE AND NAME CHANGE
http://stackoverflow.com/questions/32702921/how-do-i-change-the-default-location-for-mule-application-log-files

SED COMMAND
http://www.grymoire.com/Unix/Sed.html

LOGGING log4j change
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <Appenders>
        <RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}/S-HRM-EMP_PROFILE-PPLSFT/${date:dd-MM-yyyy}_S-HRM-EMP_PROFILE-PPLSFT.log"
                 filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}/S-HRM-EMP_PROFILE-PPLSFT/${date:dd-MM-yyyy}_S-HRM-EMP_PROFILE-PPLSFT-%i.log" append="true">
            <PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
            <SizeBasedTriggeringPolicy size="15 MB" />
            <DefaultRolloverStrategy max="20"/>
        </RollingFile>
    </Appenders>
    <Loggers>


MULE AGENT
https://www.youtube.com/watch?v=DvxcC_9ZAbM
https://docs.mulesoft.com/runtime-manager/installing-and-configuring-runtime-manager-agent
http://mulesoft.github.io/mule-agent/


SUPRESS HTTP CALL EXCEPTION
http://stackoverflow.com/questions/23240991/mule-returns-500-instead-of-400/40101417#40101417
http://stackoverflow.com/questions/16482500/mule-how-to-do-a-choice-when-based-on-http-response-codes

LOGGING

(process_id, process_name, activity_name, app_name, log_time_stamp, log_info, log_data,error_details,process_stacktrace,interface_id, project_name, message_id

#[exception.toString()]

#[exception.message]

#[exception] -- Exception- org.mule.api.MessagingException: Error sending HTTP request.
#[exception.getClass()] -- Exception Class- class org.mule.api.MessagingException
#[exception.getCause()] -- Exception Cause- java.net.ConnectException: Connect timeout
#[exception.getInfo()] --
#[exception.getMessage()] 
#[exception.getDetailedMessage()]


   message.outboundProperties['flowname'] = 'sendlog']


#[message.outboundProperties['appname'] = app.name +message.outboundProperties['flowname'] = 'sendlog']

#[exception.event.flowConstruct.name] - to get flow name when exception happens
#[exception.failingMessageProcessor] - to get step name at which exception happened

MuleMessage.getCorrelationId()
java.util.UUID.randomUUID().toString()

BATCH
https://docs.mulesoft.com/mule-user-guide/v/3.7/batch-filters-and-batch-commit
https://github.com/mulesoft/mulesoft-docs/blob/master/mule-user-guide/v/3.8/using-mel-with-batch-processing.adoc

DEPLOYMENT ARCHITECTURE
http://blogs.mulesoft.com/dev/anypoint-platform-dev/zen-api-platform-deployment-architecture/

SCATTER GATHER
after you do scatter then you need out put from each route then u need to explicitly store in payload. So after the execution of all routes payload
will be having list of result from each route. So when you do #[payload[0]] u get route 1 result and etc.


SECURITY
https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-the-spring-security-manager   -- username and password security

http://blogs.mulesoft.com/dev/howto/apply-oauth-policy-on-a-rest-api/
https://docs.mulesoft.com/mule-user-guide/v/3.7/mule-sts-oauth-2.0a-example-application
https://docs.mulesoft.com/api-manager/building-an-external-oauth-2.0-provider-application
https://docs.mulesoft.com/mule-user-guide/v/3.8/authentication-in-http-requests
https://docs.mulesoft.com/mule-user-guide/v/3.7/authorization-grant-types

https://dzone.com/articles/oauth-20-mule
http://blogs.mulesoft.com/dev/connectivity-dev/step-by-step-oauth2-configuration-in-http-connector/
https://www.youtube.com/watch?v=1N1miITLxlI

https://www.youtube.com/watch?v=io_r-0e3Qcw - good video for OUATH concept
http://www.slideshare.net/anir37/rest-security-with-oauth-20

https://www.youtube.com/watch?v=MwjYmDUDkOA - solid working example

STUDIO JAVA VERSION
https://support.mulesoft.com/s/article/How-to-select-Java-version-to-execute-Studio

https://www.youtube.com/watch?v=MwjYmDUDkOA

XSLT
http://marcotello.com/mule-esb/using-the-xslt-transformer-in-mule-esb/ - really good example


HDFS
https://docs.mulesoft.com/release-notes/hdfs-connector-release-notes
hadoop version    - this is the command to know about version
http://stackoverflow.com/questions/11302305/how-to-know-hive-and-hadoop-versions-from-command-prompt


CONNECTORS CATEGORY
https://docs.mulesoft.com/mule-user-guide/v/3.8/anypoint-connectors

GROVY
message.getInvocationProperty('myflowVariable')
message.getProperty("myflowVariable",org.mule.api.transport.PropertyScope.INVOCATION)
flowVars['myflowVariable]

JAVA CODE

accessing spring in java code
eventContext.getMuleContext().getRegistry().get("ErrorMapCounter");
muleContext.getRegistry().registerObject("totalfactvar", flowVars.factory);- this can be retrieved later in java code like below
muleContext.getRegistry().get("totalfactvar");

Dataweave Indentation -
select all - ctrl+Shift+F

DECODE for
#[(org.apache.commons.codec.binary.Base64.decodeBase64(dw('payload.GetDocumentBytesResponse.GetDocumentBytesResult')))]

THREAD DUMP HEAP DUMP
https://support.mulesoft.com/s/article/How-to-obtain-as-much-information-as-possible-from-unresponsive-Mule-server

there is utility called jvisualvm.exe whcih can be used to see heap dump which show classes , number of instances and memory . This utility will accept .hprof files. you can just save headp dump file as .hprof

open jvisualvm.exe and then start any java program then you can see that program in left side . right click and say thread dump will give thread dump


REFER FILE FROM JAVA IN MULE / READ FILE FROM JAVA
http://stackoverflow.com/questions/30497880/mule-unable-to-locate-json-file-when-deployable-archive-move-to-cloudhub
Thread.currentThread().getContextClassLoader().getResourceAsStream("input.json");
${app.home}/classes/fileName

#[groovy:Thread.currentThread().getContextClassLoader().getResourceAsStream('insulationColorAndShedsProfileInterChange_fixed_new.xml').text]

if you just want to give path of file in java
Thread.currentThread().getContextClassLoader().getREOURCE(FILE_LOCATION).fileURI;

"FILE_LOCATION" will be property in prooperty file


_______________________________________________________________________________________________________________________

excel file as an inline downloaded file within the browser as a response.

You have to use two “Property Operations” to set the “http response” as a downloadable file.

1. Set Property:
Name – Content-Type
Value - application/vnd.ms-excel (The file type is excel for our case)

2. Set Property:
Name - Content-Disposition
Value - inline;filename="#[flowVars['yearVar']]_12_CAPEX_#[flowVars['zoneVar']].xlsm"

                The configuration XML looks like this,

<set-property propertyName="Content-Type" value="application/vnd.ms-excel" doc:name="Property"/>

<set-property propertyName="Content-Disposition" value="inline;filename=&quot;#[flowVars['yearVar']]_12_CAPEX_#[flowVars['zoneVar']].xlsm&quot;" doc:name="File_Name_Property_Jan"/>

_______________________________________________________________________________________________________________________________

mule client and event context
https://docs.mulesoft.com/mule-user-guide/v/3.7/using-the-mule-client
http://stackoverflow.com/questions/32710005/steps-to-call-a-mule-flow-from-java-class

Mule context
https://echarish.wordpress.com/2017/02/22/trigger-mule-flow-from-java/
https://forums.mulesoft.com/questions/37469/calling-in-app-mule-flow-from-java-code.html

CALL FLOW FROM DataWeave
#[dw('lookup("theFlowName", flowVars.theParam)')]
"Variable" : lookup("flowName", inputToFlow)

https://forums.mulesoft.com/questions/37770/how-can-i-call-a-flowsubflow-using-mel.html

DataWeave filter
%dw 1.0
%output application/json
%var countrylist = p('countries') splitBy ','
---
{
  "COUNTRY": countrylist [?($=="INDIA")] map ((current , indexOfCurrent) -> {
       "NAME": current,
       "POS": indexOfCurrent
   }
  )
}   

______________________________________________________________________________________________________________

ANYPOINT ENTERPRISE SECURITY VAULT
https://docs.mulesoft.com/release-notes/anypoint-enterprise-security-release-notes

____________________________________________________________________________________________________________________

MUNIT
https://docs.mulesoft.com/munit/v/1.1/example-testing-apikit
https://docs.mulesoft.com/munit/v/1.0/munit-suite#defining-an-munit-test
https://stackoverflow.com/questions/37444394/assert-exception-thrown-in-munit-mulesoft
https://stackoverflow.com/questions/44197914/how-to-write-a-test-case-for-negative-scenarioexception-scenario-in-munit

_________________________________________________________________________________________________________________________________

CLOUD VCORE
https://stackoverflow.com/questions/42245989/how-can-i-configure-heap-size-and-garbage-collection-in-cloudhub

______________________________________________________________________________________________________________________________

API security

https://blogs.mulesoft.com/dev/api-dev/api-security-platform-capabilities-and-api-led-connectivity-example/

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’)