Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

JIRA Data Load to Database (JSON to Database)

avatar
Expert Contributor

Hello Team,

I have created the flow lile below

InnovokeHttp --> JOLTTransformJSON --> Putdatabase record

However While testing this process insert the data in database whenever record count is one. whenever records are more then 1 then its trigger the error. I tried to changes the JOLT spec to accept the multiple values but no luck.

---------------------------------------------------------------------------

--Sample JSON record extracted from JIRA.

---------------------------------------------------------------------------

{
"expand": "schema,names",
"startAt": 0,
"maxResults": 50,
"total": 1,
"issues": [
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "10000",
"self": "https://your-jira-instance.com/rest/api/2/issue/10000",
"key": "TEST-1",
"fields": {
"summary": "Example issue summary",
"description": "This is a detailed issue description.",
"status": {
"name": "Open"
},
"assignee": {
"name": "John Doe"
},
"reporter": {
"name": "Jane Smith"
},
"created": "2023-11-21T15:22:00.000+0000",
"updated": "2023-11-21T15:45:00.000+0000",
"project": {
"key": "TEST"
}
}
}
]
}

---------------------------------------------------------------------------

--JOLT Spec

---------------------------------------------------------------------------

[
{
"operation": "shift",
"spec": {
"issues": {
"*": {
"id": "id",
"key": "key_id",
"fields": {
"summary": "summary",
"status": {
"name": "status"
},
"assignee": {
"name": "assignee"
},
"reporter": {
"name": "reporter"
},
"created": "created",
"updated": "updated",
"project": {
"key": "project"
}
}
}
}
}
}
]

Any hint would be appriciated or alternative way to create flow also help.

 

Shakib M.
1 REPLY 1

avatar
Super Mentor

@saquibsk 

Sounds like you should be using the JoltTransformRecord processor instead of the JoltTransformJson processor.  You could then use a Json Reader (JsonTreeReader or JsonPathReader) and JsonRecordSetWriter the read and write the output of a multi-record FlowFile's contents.

This allows the configured transform to be applied to each individual record instead being applied against the entire multi-record content.

If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt