Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

An advanced mule 4 error handler library with handler overriding and extension

Notifications You must be signed in to change notification settings

mulesoft-consulting/error-handler-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

error-handler-library

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

Getting Started

As per Organization needs, modify error handler library by

  • Add new error types
  • Modify default error message
  • Modify Error processing logic

Steps:

  1. Clone the repository
  2. Update library as required
  3. 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.

How to Use?

Create new API/ Update Existing API with Error handler library

Steps:

  1. Please make sure you have user credentials in settings.xml file in local .m2 folder
  2. Publish Json logger in Customer Exchange
  3. Add json-logger to project if it has not been added before and Configure json-logger global element
  4. 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>
  1. Go to Project root folder and execute mvn clean install . This should pull the library files from Exchange or Artefact repo.
  2. 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)
  3. 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)
  4. Add flow reference to MainErrorHandlerFlow in On Error Propagate or On 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

About

An advanced mule 4 error handler library with handler overriding and extension

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published