Skip to content

NIFI-4786 - Allow Expression Evaluation to Kinesis/Firehose Stream Name#2409

Closed
SunSatION wants to merge 4 commits intoapache:masterfrom
SunSatION:master
Closed

NIFI-4786 - Allow Expression Evaluation to Kinesis/Firehose Stream Name#2409
SunSatION wants to merge 4 commits intoapache:masterfrom
SunSatION:master

Conversation

@SunSatION
Copy link

@SunSatION SunSatION commented Jan 17, 2018

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-XXXX where XXXX 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?
  • 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.

@jvwing
Copy link
Contributor

jvwing commented Jan 18, 2018

Reviewing...

session.exportTo(flowFile, baos);
records.add(new Record().withData(ByteBuffer.wrap(baos.toByteArray())));

if ( !recordHash.containsKey(firehoseStreamName) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for following the pre-existing code style in this class file. That's usually a good practice. However, if statements in NiFi code typically have braces even for single-line contents, and there is typically no space between parenthesis:

if (somevar == true) {
    doStuff();
}

Would you please fix these up?

}

records.add(record);
if ( !recordHash.containsKey(streamName) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also please fix these ifs? I completely understand they were already that way.

@jvwing
Copy link
Contributor

jvwing commented Jan 21, 2018

@SunSatION , thanks for submitting this PR, it looks like good stuff.

May I ask how you tested the changes? For PutKinesisFirehose, I was able to run the integration test suite successfully, and I was able to manually build and run a simple flow sending data to Kinesis Firehose. For PutKinesisStream, the manual flow building worked, but I get exceptions running the integration test suite (ITPutKinesisStream.testIntegrationSuccess) as it calls putRecords():

com.amazonaws.SdkClientException: Unable to marshall request to JSON: 
com.fasterxml.jackson.dataformat.cbor.CBORGenerator.getOutputContext()Lcom/fasterxml/jackson/core/json/JsonWriteContext;

Did you try the integration tests, and did they work for you? I don't believe your change introduced this issue. A quick check of the master branch suggests it was already there, but it complicated testing.

@SunSatION
Copy link
Author

Hi @jvwing

Thanks for the PR review. I've amended some changes to follow NIFI's ifs convention.

I'll try having a look at the integration tests in the evening. I've performed the manual tests as you did and used mvn -Pcontrib-check clean install in the nifi-aws-bundle folder where now I've realised that it didn't perform the integration testing

@SunSatION SunSatION closed this Jan 24, 2018
@SunSatION SunSatION reopened this Jan 24, 2018
@SunSatION
Copy link
Author

Hi @jvwing

The problem is caused by an unsupported version of Jackson databind defined in the parent NIFI POM (2.9.3) file compared to the used by AWS Java SDK (2.6.6)

I've included the old version with scope set to test in the nifi-aws-bundle POM file, however I'm not sure whether this is the right approach. Any suggestions?

The tests were executed successfully.

Test Results - ITPutKinesisStream.log

@asfgit asfgit closed this in 8bdc291 Jan 28, 2018
@jvwing
Copy link
Contributor

jvwing commented Jan 28, 2018

@SunSatION, this is nice work. Thanks for the new Kinesis expression language features. And double thanks for fixing the if statements and the integration tests, I think your Jackson test dependency fix is a good approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants