Adsense

February 09, 2020

Benefits of Git tagging in DevOps Release

In this article, we will be trying to understand the uses and benefits of tagging with your repository. How it helps you with your release management cycle and hot fixes in real time projects.There are few benefits as highlighted below:
  • A tag is immutable.
  • Tags are branches without branches anyway, just adding a way to reference a specific version of the project to reduce complexity.
  • Use of tags for release versioning is better than using branches commits.
  • You can easily compare the changes between the releases.With Tags you can keep track release versions with every project release cycle.
  • Tags are mainly used for future reference to the specific version of the project, by tagging a commit.
  • With every project releases we should provide an additional piece of documentation that can be extremely helpful in certain cases. With Tags you can add these documentation easily that can be useful for your team-members and clients.
  • Tags are easy to refer while discussion of any release bugs/ defects with your team members.
  • Tags also helps to easy rollback changes to last stable release in case of something breaks with the new release deployments.
  • With tags it is easy to investigate/replicate in local when defects are hard to identify.
  • In some of retail companies which sells their product online might release/deploy with high frequency.

Now Let's understand the different types of branches which we normally use in our project developments. Each of these branches is having a specific purpose. Based on the situation these branches behaves as an originating or merge targets branch.
Git-branches


In my next article, I will show you how these branches can be useful for your git release in DevOps environments. 

Read More »

February 08, 2020

Optimize Json data using DataWeave

In this Article, we will see how we can optimize and allow Json data to accept and transform duplicate elements. In real-time projects optimizing data really matters when we talk about tuning performance. Either you say in terms of  logging data or in terms of processing data every byte matters.


In DataWeave, we have two properties which will hep us to optimize our application data.

  • duplicateKeyAsArray: JSON data does not allow duplicate keys within same parent, so we may get exception in real-time project development scenario. With this attribute, if your dataweave finds any duplicate keys, it will create an array with all those values.

Sample XML Input:

<users>
 <user>
  <personal_information>
   <first_name version="V1">Manish</first_name>
   <first_name version="V1">Mak</first_name>
   <middle_name>Kumar</middle_name>
   <last_name>Sah</last_name>
  </personal_information>
 </user>
</users>


Dataweave Script:


%dw 2.0
output application/json duplicateKeyAsArray=true
---
payload


Sample Output:


{
  "users": {
    "user": {
      "personal_information": {
        "first_name": [
        "Manish",
        "MaK"
        ],
        "middle_name": "Kumar",
        "last_name": "Sah"
      }
    }
  }
}

  • indent: It indicates whether you want to compress your JSON data into a single line or you need JSON data for better readability.
Sample Input:
<users>
 <user>
  <personal_information>
   <first_name version="V1">Manish</first_name>
   <first_name version="V1">Mak</first_name>
   <middle_name>Kumar</middle_name>
   <last_name>Sah</last_name>
  </personal_information>
 </user>
</users>


Dataweave Script:


%dw 2.0
output application/json duplicateKeyAsArray=true, indent=false
---
payload


Sample Output:


{"users": {"user": {"personal_information": {"first_name": ["Manish","MaK"],"middle_name": "Kumar","last_name": "Sah"}}}}


Happy Learning :)

Read More »

February 06, 2020

How to write Attributes from XML to Json - DW2

In project development sometimes we needed to convert the payload from xml to json. We also need to write the xml attributes after transformation. 

For this purpose we can use writeAttributes=true in header section of data-weave. This attribute is available from Dataweave2.


Please find the snippets below:



Sample XML Input:

<users>
<user>
<personal_information>
<first_name version="V1">Manish</first_name>
<middle_name>Kumar</middle_name>
<last_name>Sah</last_name>
</personal_information>
</user>
</users>


Dataweave Script

%dw 2.0
output application/json writeAttributes=true
---
payload

Output:

{
  "users": {
    "user": {
      "personal_information": {
        "first_name": {
          "@version": "V1",
          "__text": "Manish"
        },
        "middle_name": "Kumar",
        "last_name": "Sah"
      }
    }
  }
}

Happy Learning :)
Read More »

February 04, 2020

Five pillars of Azure DevOps

In this article I will discuss about the five pillars(components) of Azure DevOps. These pillars actually helps to build and manage development life-cycle. 
Development life-cycle consists of : 


      • Requirement gathering, 
      • Work plan, 
      • Code management, 
      • CI/CD.
      • Test plans
These components helps key stakeholders proper real time insights of the projects.
5-pillars-of-Azure-DevOps

Azure Boards

Plan, track, and discuss work across teams, deliver value to your users faster. Boards is used for agile project planning. It is a management tool that provides you the ability to link repos, work items, tasks and sub-tasks. With Azure Boards you can track backlogs and customize dashboards and create custom reporting. It easily helps to monitor progress throughout the lifecycle of your project. Moreover you can integrate boards with tools like Microsoft Teams and Slack to sync up with members.
azure-boards

Azure Repos

Unlimited cloud-hosted private Git repos. Collaborative pull requests, advanced file management, and more.
Azure Repos functionality differs between choosing your Git or Team Foundation Source Control. The most common choice is Git. Git is there with the added benefit of linking commits and pull requests to Work Items and CI. you can customise your branch policies to maintain your team’s high standards. It provides you to protect your code quality with branch policies. you can add code reviewer signoff to keep code quality high.
azure-repos



Azure Pipelines

CI/CD that works with any language, platform, and cloud. Connect to GitHub or any Git provider and deploy continuously to any cloud. It allows the building, testing and deployment of code using DevOps practices.
azure-pipeline

Azure Test Plans

The test management and exploratory testing toolkit that lets you ship with confidence. 
azure-test-plans

Azure Artifacts

Create, host, and share packages. Easily add artifacts to CI/CD pipeline. You can share code effortlessly by storing Maven, npm, NuGet and Python packages together and add artifacts to your CI/CD pipelines with a single click.

Azure Overview  gives you real time insights of the project.
Azure-Devops-overview



Happy Learning :)
Read More »

December 05, 2019

Anypoint MQ Circuit Breaker - Mule4

In integration development there are lot of patterns that we can follow based on project requirements. Circuit Breaker is one of them.
In this article we will see how Circuit Breaker can be used and what we should consider while implementing it. 

Circuit breaker design pattern is used when:

  • To handle error scenarios and message reprocessing strategy.


Mulesoft has provided circuit breaker capability with Anypoint MQ component.
You can add dependency inside your pom as below:

<dependency>
<groupId>com.mulesoft.connectors</groupId>
<artifactId>anypoint-mq-connector</artifactId>
<version>3.1.0</version>
<classifier>mule-plugin</classifier>
</dependency>

Now, I will show you how you can design and configure your mule flows for implementing Circuit Breaker capability.


Below is the sample circuit breaker mule flow design:


flow-design-circuit-breaker

We will explain each and every part the above flow design below:


Circuit Breaker Configuration:

Go to global elements section create a Circuit breaker configuration as below:



circuit-breaker-configuration


This configuration can be shared across multiple Subscriber resources in the project.
On Error Types – Type of Errors based on which you want to Open the Circuit.
Errors Threshold – No. of Failures in Succession – Ex: 5
Trip Timeout – Duration to keep the Circuit Open once the ErrorThreshold is reached – Ex: 60 Minutes


Subscriber Configuration

Anypoint MQ Subscriber Source provides Circuit Breaking Capability.
                                                       
subscriber-circuit-breaker-config

 
1. Select the Anypoint MQ Subscriber Source.
2. Click on the Advanced tab.
3. Provide the Circuit Breaker from Global Reference.



AMQ Message Processing\Listening Strategy:


amq-subscriber-configuration


This section describes the methodology how we are going to follow to process messages from Anypoint MQ. This process helps in effectively handling reprocessing and retrying scenarios and also simplifies the process from a maintenance perspective.


Steps:

  1. Configure the Subscribe processor
  2. Subscriber Type – Prefetch
  3. Max Local Messages –  default it to 5, you can change based on requirement for further tuning.
  4. Acknowledgment Mode – Set to MANUAL, As the Acknowledgement Mode is set to MANUAL, we need to Ack the message post successful completion of the flow. So that the message doesn’t get retried/consumed.


Circuit Breaker and AMQ Listening Strategy both need to be configured in our components where we want messages to be reprocessed and retried in a configurable manner.

In case of Error Scenarios,



error-propagate-type

Based on your requirement you can catch the error and subsequent to Error Handling, Nack the message so that the message stays on the queue and will be subsequently redelivered.


nack-token-vars



You can use Ack the message so that the message is removed from the queue in case of success scenarios.


ack-token-vars

This ackToken you can store in variable which can be used for Ack/Nack of the message.


set-attributes


MQ messages stores in queue after getting Nack

mq-msg-properties-details



Please find sample Mule project in Github Error-Handling-using-Anypoint-MQ-Circuit-Breaker
Read More »