From bb96b0f46412008ade2b5abe2d4ee9970af576fd Mon Sep 17 00:00:00 2001 From: Pierre Villard Date: Fri, 5 May 2017 18:09:04 +0200 Subject: [PATCH] NIFI-3816 - Added correct mime.type to S2S bulletin and provenance reporting tasks This closes #1758. Signed-off-by: Koji Kawamura --- .../nifi/reporting/SiteToSiteBulletinReportingTask.java | 7 ++++++- .../nifi/reporting/SiteToSiteProvenanceReportingTask.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java index 9d9b1b7d67..566b7804db 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java @@ -23,6 +23,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.OptionalLong; @@ -163,9 +164,13 @@ public class SiteToSiteBulletinReportingTask extends AbstractSiteToSiteReporting return; } + final Map attributes = new HashMap<>(); final String transactionId = UUID.randomUUID().toString(); + attributes.put("reporting.task.transaction.id", transactionId); + attributes.put("mime.type", "application/json"); + final byte[] data = jsonArray.toString().getBytes(StandardCharsets.UTF_8); - transaction.send(data, Collections.singletonMap("reporting.task.transaction.id", transactionId)); + transaction.send(data, attributes); transaction.confirm(); transaction.complete(); diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java index 2123e31f1c..9d6d009be7 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java @@ -212,6 +212,7 @@ public class SiteToSiteProvenanceReportingTask extends AbstractSiteToSiteReporti final Map attributes = new HashMap<>(); final String transactionId = UUID.randomUUID().toString(); attributes.put("reporting.task.transaction.id", transactionId); + attributes.put("mime.type", "application/json"); final byte[] data = jsonArray.toString().getBytes(StandardCharsets.UTF_8); transaction.send(data, attributes);