Saturday, August 3, 2019

Mule Application Hacking: Reveal Details Of A Connector's Connection

Introduction

In my last hacking post, I described the method to view the source code of Mule connectors using the ECD. In this article, I am go demonstrate the procedure to reveal the details about connection and communication within the Mule Connector. This is very useful for the purpose of trouble-shooting.

I will use Salesforce connector as example to demonstrate how to read connection details, query, etc.

Details

First, looking for the connector as shown in the following snapshots:
As you can see, I have added Salesforce connection version 9.7.7. Now, we need to expand the connector. Then looking for mule-salesforce-connector-9.7.7-mule-pluging.jar and expand the jar file as shown below:
Now we can see that the java class packages all under org.mule.extension.salesforce.

The next step is to add the package to log4j.xml in the dir of src/main/resources as shown below:

Now add the package of org.mule.extension.salesforce into the Loggers section of the log4j.xml file as shown below
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  <loggers>
       
      <!-- Http Logger shows wire traffic on DEBUG. -->
      <!--AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" /-->
      <asynclogger name="org.mule.service.http" level="WARN">
      <asynclogger name="org.mule.extension.http" level="WARN">
      <asynclogger name="org.mule.extension.salesforce" level="DEBUG">
   
<!-- Mule logger -->       
      <asynclogger name="org.mule.runtime.core.internal.processor.LoggerMessageProcessor" level="INFO">
 
      <asyncroot level="INFO">
          <appenderref ref="file">
      </appenderref></asyncroot>
  </asynclogger></asynclogger></asynclogger></asynclogger></loggers>
Now, if you run the project, the console will deplay the debugging information about the connection information, request, and response from Salesforce connectors.

3 comments:

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-...