NIFI-3816 - Added correct mime.type to S2S bulletin and provenance reporting tasks

This closes #1758.

Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>
This commit is contained in:
Pierre Villard 2017-05-05 18:09:04 +02:00 committed by Koji Kawamura
parent 7a46238baf
commit bb96b0f464
2 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -163,9 +164,13 @@ public class SiteToSiteBulletinReportingTask extends AbstractSiteToSiteReporting
return; return;
} }
final Map<String, String> attributes = new HashMap<>();
final String transactionId = UUID.randomUUID().toString(); 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); 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.confirm();
transaction.complete(); transaction.complete();

View File

@ -212,6 +212,7 @@ public class SiteToSiteProvenanceReportingTask extends AbstractSiteToSiteReporti
final Map<String, String> attributes = new HashMap<>(); final Map<String, String> attributes = new HashMap<>();
final String transactionId = UUID.randomUUID().toString(); final String transactionId = UUID.randomUUID().toString();
attributes.put("reporting.task.transaction.id", transactionId); attributes.put("reporting.task.transaction.id", transactionId);
attributes.put("mime.type", "application/json");
final byte[] data = jsonArray.toString().getBytes(StandardCharsets.UTF_8); final byte[] data = jsonArray.toString().getBytes(StandardCharsets.UTF_8);
transaction.send(data, attributes); transaction.send(data, attributes);