[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-30 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/nifi/pull/2663


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-30 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r191668970
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -50,7 +50,7 @@ Record writer
{ "name" : "actorHostname", "type" : "string"},
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
-   { "name" : "parentId", "type" : "string"},
+   { "name" : "parentId", "type" : ["string", "null"]},
--- End diff --

I think I remember vaguely something like that but I think it was an issue 
on our side with the Record API (can't find a JIRA though). I looked at other 
projects I've been working on and I've schemas with "null" being first or 
second and I had no issue.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-29 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r191634954
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -50,7 +50,7 @@ Record writer
{ "name" : "actorHostname", "type" : "string"},
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
-   { "name" : "parentId", "type" : "string"},
+   { "name" : "parentId", "type" : ["string", "null"]},
--- End diff --

That looks VERY familiar but I think even the first time we dealt with Avro 
it might have been 1.7.x after it had been fixed (plus that had to do with 
default values being supported with unions). Maybe I'm thinking of a NiFi 
Record API bug with unions and defaults. But either way, if this LGTY it LGTM :)


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-29 Thread MikeThomsen
Github user MikeThomsen commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r191607896
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -50,7 +50,7 @@ Record writer
{ "name" : "actorHostname", "type" : "string"},
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
-   { "name" : "parentId", "type" : "string"},
+   { "name" : "parentId", "type" : ["string", "null"]},
--- End diff --

If you mean [this bug](https://issues.apache.org/jira/browse/AVRO-1118) 
looks like it was fixed a long time ago.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-29 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r191553752
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -50,7 +50,7 @@ Record writer
{ "name" : "actorHostname", "type" : "string"},
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
-   { "name" : "parentId", "type" : "string"},
+   { "name" : "parentId", "type" : ["string", "null"]},
--- End diff --

Isn't there some Avro bug where the null has to come first? If that's been 
fixed, I'm good with this, otherwise we might have to switch it around.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-25 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r190853722
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -0,0 +1,122 @@
+
+
+
+
+
+SiteToSiteStatusReportingTask
+
+
+
+
+
+   
+   The Site-to-Site Bulletin Reporting Task allows the 
user to publish Status events using the Site To Site protocol. 
--- End diff --

Fixed


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-25 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r190854010
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -0,0 +1,122 @@
+
+
+
+
+
+SiteToSiteStatusReportingTask
+
+
+
+
+
+   
+   The Site-to-Site Bulletin Reporting Task allows the 
user to publish Status events using the Site To Site protocol. 
+   The component type and name filter regexes form a 
union: only components matching both regexes will be reported. 
+   However, all process groups are recursively searched 
for matching components, regardless of whether the process 
+   group matches the component filters.
+   
+   
+   Record writer
+   
+   
+   The user can define a Record Writer and directly 
specify the output format and data with the assumption that the 
+   input schema is the following:
+   
+
+   
+   
+{
+  "type" : "record",
+  "name" : "status",
+  "namespace" : "status",
+  "fields" : [
+// common fields for all components
+   { "name" : "statusId", "type" : "string"},
+   { "name" : "timestampMillis", "type": { "type": "long", "logicalType": 
"timestamp-millis" } },
+   { "name" : "timestamp", "type" : "string"},
+   { "name" : "actorHostname", "type" : "string"},
+   { "name" : "componentType", "type" : "string"},
+   { "name" : "componentName", "type" : "string"},
+   { "name" : "parentId", "type" : "string"},
--- End diff --

That's not what I'm seeing: only the status of the root process group does 
have a null parentId which makes sense. But I do see the correct parentId on 
the other components. I updated the schema/doc to allow the null value though.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-05-11 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r187685161
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -0,0 +1,122 @@
+
+
+
+
+
+SiteToSiteStatusReportingTask
+
+
+
+
+
+   
+   The Site-to-Site Bulletin Reporting Task allows the 
user to publish Status events using the Site To Site protocol. 
+   The component type and name filter regexes form a 
union: only components matching both regexes will be reported. 
+   However, all process groups are recursively searched 
for matching components, regardless of whether the process 
+   group matches the component filters.
+   
+   
+   Record writer
+   
+   
+   The user can define a Record Writer and directly 
specify the output format and data with the assumption that the 
+   input schema is the following:
+   
+
+   
+   
+{
+  "type" : "record",
+  "name" : "status",
+  "namespace" : "status",
+  "fields" : [
+// common fields for all components
+   { "name" : "statusId", "type" : "string"},
+   { "name" : "timestampMillis", "type": { "type": "long", "logicalType": 
"timestamp-millis" } },
+   { "name" : "timestamp", "type" : "string"},
+   { "name" : "actorHostname", "type" : "string"},
+   { "name" : "componentType", "type" : "string"},
+   { "name" : "componentName", "type" : "string"},
+   { "name" : "parentId", "type" : "string"},
--- End diff --

Currently in 
https://github.com/apache/nifi/pull/2663/files#diff-f1f37886c50fa0946558aed14f835e27R147
 it is sending in null for the parentId all the time. I think we should 
determine the parentId if possible, and (at least) make the field in the schema 
nullable.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-04-30 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r185001042
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
 ---
@@ -0,0 +1,122 @@
+
+
+
+
+
+SiteToSiteStatusReportingTask
+
+
+
+
+
+   
+   The Site-to-Site Bulletin Reporting Task allows the 
user to publish Status events using the Site To Site protocol. 
--- End diff --

Minor copy-paste error here, should be Site-to-Site Status Reporting Task. 
I can update while merging.


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-04-27 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r184788317
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java
 ---
@@ -76,10 +81,16 @@
 
 private volatile long lastSentBulletinId = -1L;
 
+public SiteToSiteBulletinReportingTask() throws IOException {
+final InputStream schema = 
getClass().getClassLoader().getResourceAsStream("schema-bulletins.avsc");
+recordSchema = AvroTypeUtil.createSchema(new 
Schema.Parser().parse(schema));
+}
+
 @Override
 protected List getSupportedPropertyDescriptors() {
 final List properties = new 
ArrayList<>(super.getSupportedPropertyDescriptors());
 properties.add(PLATFORM);
+properties.add(RECORD_WRITER);
--- End diff --

Yeah I asked myself this question... I was not sure if it'd make sense to 
move it to the abstract base class in case some users implemented custom 
impl... but that wouldn't break anything (just the addition of an unused 
property) so it's probably cleaner to have it in the abstract class. What's 
your feeling?


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-04-27 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r184757759
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java
 ---
@@ -153,8 +164,12 @@ public void onTrigger(final ReportingContext context) {
 attributes.put("reporting.task.type", 
this.getClass().getSimpleName());
 attributes.put("mime.type", "application/json");
 
-final byte[] data = 
jsonArray.toString().getBytes(StandardCharsets.UTF_8);
-transaction.send(data, attributes);
+if(context.getProperty(RECORD_WRITER).isSet()) {
--- End diff --

The first one you did also has a customValidate method, can we put that 
logic into the base class (not necessarily in the exact customValidate() method 
but something all of these can call)? If we add the property to the base class, 
then it could be in the base class's customValidate(), your call :)


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-04-27 Thread mattyb149
Github user mattyb149 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2663#discussion_r184757401
  
--- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java
 ---
@@ -76,10 +81,16 @@
 
 private volatile long lastSentBulletinId = -1L;
 
+public SiteToSiteBulletinReportingTask() throws IOException {
+final InputStream schema = 
getClass().getClassLoader().getResourceAsStream("schema-bulletins.avsc");
+recordSchema = AvroTypeUtil.createSchema(new 
Schema.Parser().parse(schema));
+}
+
 @Override
 protected List getSupportedPropertyDescriptors() {
 final List properties = new 
ArrayList<>(super.getSupportedPropertyDescriptors());
 properties.add(PLATFORM);
+properties.add(RECORD_WRITER);
--- End diff --

Is the intent here to allow all S2S Reporting Tasks to use the record 
writer if they want, or do we want to make it "mandatory" by including it in 
the properties from the abstract base class?


---


[GitHub] nifi pull request #2663: NIFI-5122 - Add Record Writer for S2S RTs

2018-04-27 Thread pvillard31
GitHub user pvillard31 opened a pull request:

https://github.com/apache/nifi/pull/2663

NIFI-5122 - Add Record Writer for S2S RTs

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [ ] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [ ] Is your initial contribution a single, squashed commit?

### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/pvillard31/nifi NIFI-5122

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/2663.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2663


commit e0279d8768e3217cf7853d9d5d17c36a81c4c45e
Author: Pierre Villard 
Date:   2018-04-27T15:41:39Z

NIFI-5122 - Add Record Writer for S2S RTs




---