Huong Dan Java Logger – Part 10 – Return payload after logging

Let’s imagine, Huong Dan Java Logger is an endpoint in a Mule Flow. When Mule Flow processes the request to the Huong Dan Java Logger endpoint, it executes all the lines of code contained in the log() method of the HuongDanJavaLoggerComponentConnector class. After the execution for this code is completed, the return value of this method will be the payload of the message Mule.

Currently, if you use Huong Dan Java Logger in your Mule application, you will see that after the Huong Dan Java Logger endpoint, the value of the payload is the value of the Correlation Id.

For example, I have a small Mule application like this:

Huong Dan Java Logger – Part 10 - Return payload after logging

In particular, Huong Dan Java Logger is configured as follows:

Huong Dan Java Logger – Part 10 - Return payload after logging

Global Configuration:

Huong Dan Java Logger – Part 10 - Return payload after logging

The Logger component is configured as follows:

Huong Dan Java Logger – Part 10 - Return payload after logging

When running the result will be:

Huong Dan Java Logger – Part 10 - Return payload after logging

As I said and as you can see, now after passing Huong Dan Java Logger, the payload of Mule Message is the value of Correlation Id.

To fix this, just change the return code in the log() method of the HuongDanJavaLoggerComponentConnector class as follows:

 

Huong Dan Java Logger – Part 10 – Return payload after logging
Đánh giá bài viết
Chia sẽ bài viết này ...Share on Facebook
Facebook
3Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.