An advanced mule 4 error handler library with handler overriding and extension. Not to be confused with error handler plugin. This is a comprehensive library to handle different types of errors (your could update the framework to send cloudhub notifications, create service now tickets, write to MQ, BD etc per error type)
Design document: https://wiki.corp.mulesoft.com/display/OBD/Error+Handler+Library
As per Organization needs, modify error handler library by
- Add new error types
- Modify default error message
- Modify Error processing logic
- Clone the repository
- Update library as required
- Run
mvn deploy
from project root folder to Publish this library to your/customer artifact repo (Nexus, artefactory, azure repo etc).
This can be published to Exchange by updating the project.groupId. Best practice would be to use artefact repo
(Make sure you have appropriate credentials configured in settings.xml
file in local .m2
folder.
- Please make sure you have user credentials in
settings.xml
file in local.m2
folder - Publish Json logger in Customer Exchange
- Add json-logger to project if it has not been added before and Configure json-logger global element
- In Project pom.xml file add the below plugin in
<build>
session along with other plugins
<build>
....
</plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.dependency.plugin.version}</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<!-- *************************************************** -->
<!-- TODO: Replace with the Published error-handling artifact library details -->
<!-- *************************************************** -->
<groupId>b144f004-790a-4e9b-8ff3-61a28db48356</groupId>
<artifactId>error-handler-library</artifactId>
<version>${replace-with-latest-version}</version>
<!-- *************************************************** -->
<classifier>mule-application</classifier>
<overWrite>true</overWrite>
<outputDirectory>src/main/mule/</outputDirectory>
<includes>**/error-*.xml</includes>
</artifactItem>
<artifactItem>
<!-- *************************************************** -->
<!-- TODO: Replace with the Published error-handling artifact library details -->
<!-- *************************************************** -->
<groupId>b144f004-790a-4e9b-8ff3-61a28db48356</groupId>
<artifactId>error-handler-library</artifactId>
<version>1.0.0-SNAPSHOT</version>
<!-- *************************************************** -->
<classifier>mule-application</classifier>
<overWrite>true</overWrite>
<outputDirectory>src/main/resources/</outputDirectory>
<includes>**/*.yaml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
- Go to Project root folder and execute
mvn clean install
. This should pull the library files from Exchange or Artefact repo. - Configure properties file (Please take this configuration for reference. This file is only for reference and won't be part of library in the API)
- Make sure to configure http-listener response accordingly.(Please take this configuration for (reference This file is only for reference and won't be part of library in the API)
- Add flow reference to
MainErrorHandlerFlow
inOn Error Propagate
orOn Error Continue
to initiate the error handler libary logic. (reference. This file is only for reference and won't be part of library in the API)
Please refer this sample project for more info