Mule Rest Connector, a Simplified Option to Integrate JIRA
We will discuss to use Mule for such integration to seamless data flow issue without manual login to JIRA.
Join the DZone community and get the full member experience.
Join For FreeJIRA and Mulesoft are one of the leading products in their own space. As per the Gartner report, they are placed in the Magic quadrant. This makes sense to introduce process or demonstrate some steps, which help to automate processes or integration with other systems.
Anypoint product suite from Mulesoft is a popular ESB and having a rich list of connector/adapter to integrate the different system, hosted in an on-premise server or a cloud setup.
We will be taking on of such a product majorly issue for project management cum issue tracking. Atlassian JIRA is one of the leading products for Agile practitioners. Since the IT ecosystem is settling with a lot of the previous set of products like HP Service manager, BMC remedy, or a simple tool like MS excel. Many Agile practitioners prefer to use such a product.
We will discuss using Mule for such integration to seamless data flow issues without manual login to JIRA.
There are two ways to connect Atlassian JIRA through Mule.
- Available Connector
- REST API
You can read and download the JIRA connector in Mule exchanges. There is a maven dependency snippet that is also available in exchange to use for maven-based projects.
https://www.mulesoft.com/exchange/org.mule.modules/jirarest-connector/
The connector is built and supported by a mule partner, any license details are handled by the provider. It is not available in the studio by default. You need to download it from the exchange.
You will able to search without login in exchange but you must login to download.
Maven Dependency (use this snippet if using maven based project)
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>jirarest-connector</artifactId>
<version>1.3.0</version>
</dependency>
You can see this screen through Anypoint studio. Click Install button to get installed in anypoint studio and respond to the following screen like accepting terms and conditions etc. It will prompt to restart studio once installed successfully.
You will able to find the JIRA component in pallet now. Revisit your installation if it's still not appearing.
Using JIRA Rest Connector with Anypoint Studio 6.x
You can use the JIRA connector to connect with the Jira server and work on Jira related work. This will simplify integration with JIRA. You need to specify the host, port, and credentials for connector configuration. For Endpoint, you need to specify path and method.
Place the HTTP Listener to the source in the flow to receive the input message.
Now you can place the JIRA Rest Connector component to Message Processor inflow and configure it. Click Add Connector Configuration for Basic Authentication and it will open another window.
Provide the Jira server URL, username and password, click “Test Connection”.
Click Ok once the connection is tested successfully. The password is deprecated for cloud setup, user API token in place for a password.
Now you can place the JIRA Connector component is ready to use. A list of supported operations will be listed in operation drop-down.
We will use “create Issue” as an operation for our example. Since it needs to follow a specific message format, a transforming message will help to map the required input format.
Transferring Message
A transformation message is required if the message passed and expected by JIRA is the same. Since this case, to create a message, there is a requirement of a specific message structure, Transform message is the right fit in this type of scenario.
Sample transformation snippet.
x
fields: {
issuetype: {
id: payload.issueType
},
project: {
key: payload.projectKey
},
priority: {
id: payload.issuePriority
},
description: payload.description,
summary: payload.summary
}
Testing the Application
You can use Postman to test the application. First, deploy the application with Anypoint Studio, and run the application.
We will send a message to the Mule application using the HTTP POST method. The test URL is http://localhost:8081/issues.
Let validate in JIRA if we can find a task.
We will access newly created issue directly through JIRA rest API and validate if created Jira is accessible.
Request GET on http://localhost:8080/rest/api/2/issue/TES-51
Summary
We learn from this article
1. Where to get JIRA Rest Connector?
2. JIRA Rest Connector documentation.
3. How to download and configure in Anypoint Studio?
4. What is the requirement to go through Basic Authentication path?
5. How to use connector as message processor in flow?
6. Created and read JIRA ticket using Postman.
7. Verified in Jira console to ensure, Task is created according to input data.
Opinions expressed by DZone contributors are their own.
Trending
-
Mainframe Development for the "No Mainframe" Generation
-
Building a Flask Web Application With Docker: A Step-by-Step Guide
-
Low Code vs. Traditional Development: A Comprehensive Comparison
-
Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
Comments