Let’s discuss your requirements

    Contacts

    info@eshiasolutions.com

    +91 8780 677 436

    Blogs
    Mulesoft

    February 04 , 2021  11:09 am

    Author Name: Hardik Soni

    Sometimes it’s not good practice to write the same code again and again so we create a global element and put our code over there so that our code will become a reusable asset. For example, if we want to connect a database so it’s not good practice to configure database connection every time so we create our database configuration in global element and use it when we need with this, we don’t need to write database configuration every time.

    But what if we are coding common services again and again in our application. Let’s take one scenario every mule application has an error handler and we need to apply it on different levels as well such as system level, process level, experience level. Error handling is a common service in every mule application so is there any other way to write error-handling service as a common service and every application can access it so that they don’t need to write error handling in their application?. The answer is YES…

    Scenario

    Solution:

    For the Above scenario, we create Nexus Repository for Error-Handler and deploy it on Azure DevOps

    Pre-requisites:
    Azure DevOps Account
    Anypoint Studio
    Step-1:
    Create sample project in any point studio which is containing only error handling
    Step-2:
    Login to Azure DevOps and Create one Repository
    Step-3:
    Create a new pipeline with an appropriate name.
    Step-4:
    Click on Use the Classic Editor
    Step-5:
    Select Team Project, Repository, and Branch which you have created. And Click on Continue
    Step-6:
    Search Naven Template and Select Maven from the featured tab
    Step -7:
    Once you add Maven you can see the below screenshot remove a selected feature which is highlighted in the below screenshot

    Step-8
    Add Secure download property module
    Step-9
    Now navigate to Libra by and Add settings.xml file by default settings.xml file is located under your (<MAVEN_HOME\conf>) folder
    Step-10
    Add settings.xml file
    Step-11
    Give reference Name under output reference as per your choice
    Step-12
    Add Maven configuration as below screenshot.

    Step-13
    Navigate to Artifact and click on Create feed
    Step-14
    Give Appropriate name and click on create
    Step-16
    For connecting our application with Artifact click on Connect to feed
    Step-17
    Select maven
    Step-18
    Copy server tag and add to the settins.xml file
    To access token click on Personal Access token


    Step-19
    Copy repository tag and paste into your project’s pom file under distribution Management tag.

    Distribution Management tag should look like bellow

    Step-20
    Commit Anypoint studio error-handling project to azure DevOps repository
    Step-21
    Navigate to created Pipelines and run the pipeline with an appropriate message

    Once pipelines run successfully we will get a build success message
    Step-22
    Under Artifacts, we can see our nexus repository

    Click on our nexus repository you will find error handling common dependency so that you can use it in every project

    Now we just need to add a dependency to our project instead of writing error handling it will automatically download error-handling from the repository and add it to your project.

    Leave a comment

    Your email address will not be published.

    Previous Next
    Close
    Test Caption
    Test Description goes like this