To Debug a Mule Project (Design Center)
Once your project is deployed on a design environment server and all of your changes are updated to it, it’s time to try it out. You can trigger the event source of each flow to set it into action:
If you have an HTTP Listener as the event source, try to Send Mock Requests.
If your flow starts with a Scheduler, it’s triggered at the selected interval, you can also try to Force Redeploy your application to immediately trigger the Scheduler.
As the components in a flow are triggered in sequence, they turn green or red depending on if they work as expected or not.
For flows that are triggered by an HTTP Listener operation:
After creating your project and updating it, verify that it’s running correctly by looking at its status in the nav bar, it should read Latest Changes Deployed.
Click the options icon next to the Deploy button and select Copy Link.
Each application is deployed to a URL that follows the structure projectName.cloudhub.io.
Open a browser and paste the link to your application.
To that link, append the path to the specific HTTP listener you want to trigger. For example: if your project is deployed to
http://myapp.cloudhub.ioand your HTTP listener listens to the Path
/helloworld, then you should be able to activate that flow by pointing your browser to
|If your flow needs to receive a more complete HTTP request (with body, headers, etc) you can instead use tools like Postman or curl to send HTTP requests.|
Flows that are triggered by a Scheduler component are regularly triggered at the selected interval, but you can also instantly trigger it into action by forcing the redeployment of your application.
To do so, simply click the
Deploy button again.
|Note that a Scheduler keeps triggering its flow until you either stop the application or make changes that stop it, and click Deploy.|
When your flows are triggered and actual data transitions through the flows, it’s recorded in the Input and Output tabs of each component.
On both the Input and Output tabs, you can navigate the information in various ways:
Select the specific event to view. Each time the flow is triggered, an event is generated, and you can view not only the last data of these events, but also previous ones. Each event is selectable by the time at which it occurred (in your local time zone).
Select what part of the Mule event object to view: payload, attributes, variables or errors.
Closing and opening the Design Center project or reloading the page would cause you to lose data from the Input and Output views. When you make changes to a deployed application, data is also lost on those flows that have changed or that reference a configuration element that has changed.
Note that Design Center only has access to your application’s data when it runs in the design environment that the application was created on. Once you promote your application to a production environment, the data in your flows is secure.
Add one or several Logger cards to your flow, placing them on the key places where you what to know what data is going through.
Click each logger card to open it and set the Message field to any specific part of the Mule Event that you’re interested in.
Execute your flow with a trigger. Refer to Send Mock Requests or Force Redeploy above.
Expand the Log tab at the bottom of the screen to view log data. This should include what the data that the logger components processed, along with messages related to the running of the app and any possible errors.