Sunday, May 20, 2018

Mule 4 Introduction - Embedded Runtime Information

Introduction

Mule Runtime 4.1 and AnypointStudio have changed significantly from Mule 3. The runtime information, such as applications, logs, libraries, etc have changed as well.

Runtime Environment Changes

First of all, if you have worked with Mule 3, you probably know where is your log, applications. They are at workspace/.mule directory as shown at the following:
gliu1@LM-SJL-11006574:~/AnypointStudio/workspace/.mule$ ll
total 16
drwxr-xr-x   3 gliu1  110500007    96 Mar  2 16:41 lib
drwxr-xr-x   5 gliu1  110500007   160 Mar 10 14:46 e0334610-24b4-11e8-b36c-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Mar 10 14:47 02ac31c0-24b5-11e8-b36c-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Mar 10 17:58 a405bdb0-24cf-11e8-b36c-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Mar 12 12:40 2dfe1450-262d-11e8-9448-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Mar 12 12:40 44128b90-262d-11e8-9448-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Apr  4 18:10 157c8440-386e-11e8-b273-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Apr  4 18:12 5eb15c80-386e-11e8-b273-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Apr  4 18:12 768759e0-386e-11e8-b273-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Apr 13 14:09 fdfecc90-3f5e-11e8-b669-acde48001122
drwxr-xr-x   5 gliu1  110500007   160 Apr 13 18:15 50393e60-3f81-11e8-b669-acde48001122
drwxr-xr-x   9 gliu1  110500007   288 May  3 19:11 plugins-tmp
drwxr-xr-x  21 gliu1  110500007   672 May  6 19:15 .
-rw-r--r--@  1 gliu1  110500007  6148 May  6 19:15 .DS_Store
drwxr-xr-x  24 gliu1  110500007   768 May 16 14:43 ..
drwxr-xr-x  75 gliu1  110500007  2400 May 17 08:26 logs
drwxr-xr-x   4 gliu1  110500007   128 May 17 19:44 conf
drwxr-xr-x   4 gliu1  110500007   128 May 17 19:44 domains
drwxr-xr-x  33 gliu1  110500007  1056 May 17 19:44 .mule
drwxr-xr-x   4 gliu1  110500007   128 May 17 19:44 apps
drwxr-xr-x   3 gliu1  110500007    96 May 17 19:44 policies
gliu1@LM-SJL-11006574:~/AnypointStudio/workspace/.mule$ 

In mule 4, this has been changed to the mule runtime installation directory. In my case, it is like the following:
gliu1@LM-SJL-11006574:/Applications/AnypointStudio-7-1-2.app/Contents/Eclipse/plugins/org.mule.tooling.server.4.1.1.ee_7.1.2.201803261303/mule$ ll
total 48
-rw-r--r--@  1 gliu1  110500007  3678 Mar 16 09:26 README.txt
-rw-r--r--@  1 gliu1  110500007   173 Mar 16 09:26 MIGRATION.txt
-rw-r--r--@  1 gliu1  110500007   518 Mar 16 09:26 LICENSE.txt
drwxr-xr-x@  8 gliu1  110500007   256 Mar 28 10:29 lib
drwxr-xr-x@  3 gliu1  110500007    96 Mar 28 10:41 tools
drwxr-xr-x@ 12 gliu1  110500007   384 Mar 28 10:41 bin
drwxr-xr-x@  8 gliu1  110500007   256 Mar 28 10:41 services
drwxr-xr-x@ 10 gliu1  110500007   320 Mar 28 10:41 ..
drwxr-xr-x   2 gliu1  110500007    64 May 18 18:16 domains-staging
drwxr-xr-x@  4 gliu1  110500007   128 May 18 18:18 server-plugins
drwxr-xr-x@  4 gliu1  110500007   128 May 18 18:18 policies
drwxr-xr-x   3 gliu1  110500007    96 May 18 18:18 tmp
-rw-r--r--   1 gliu1  110500007     0 May 19 18:18 Instance.lock
drwxr-xr-x@ 22 gliu1  110500007   704 May 19 18:18 .
-rw-r--r--   1 gliu1  110500007     6 May 19 18:18 mule_ee.pid
drwxr-xr-x   9 gliu1  110500007   288 May 19 18:18 .mule
drwxr-xr-x@ 18 gliu1  110500007   576 May 19 18:19 conf
drwxr-xr-x@  9 gliu1  110500007   288 May 19 18:19 logs
drwxr-xr-x@  4 gliu1  110500007   128 May 19 18:19 domains
drwxr-xr-x@  4 gliu1  110500007   128 May 19 18:19 apps
-rw-r--r--   1 gliu1  110500007     8 May 19 18:19 mule_ee.java.status
-rw-r--r--   1 gliu1  110500007     8 May 19 18:19 mule_ee.status
The new runtime environment is mule aligned with the standalone mule runtime directory layout. Thus, if you want to looks the runtime logs, you need to traverse to the mule directory. It is easier to create a link so that you don't have to cd to the deeper directory tree.

No More Session Variables

In mule 3, we have flowVars, sessionVars, and recordVars. In mule 4, all variables are referred as vars, i.e. vars.originalPayload. This is related to how connectors and transports work in mule 4. In mule 3, when message passes through the transport barriers the properties will change, i.e., inbound properties will become outbound properties. In Mule 4, there is no transport barrier anymore. This is because mule can handle consumable message (stream, reader, etc).

Mule Message

Mule message is mule 4 contains attributes, payload, and variables. The message.inboundproperties and message.outboundproperties are becoming attributes. message.id and message.rootId become message.serialVersionUID.

3 comments:

  1. Very informative post for mulesoft developers.You can also visit goformule.com for mulesoft stuff.

    ReplyDelete
  2. Thanks for sharing valuable information and very well explained. Keep posting.

    mule 4 certification
    mule 4 online training

    ReplyDelete
  3. Thank you for sharing wonderful information with us to get some idea about it.
    Mule ESB Training
    Mule 4 Training

    ReplyDelete

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...