You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/10 23:32:19 UTC

[GitHub] [nifi] nandorsoma opened a new pull request, #6649: NIFI-10760 Allow publishing AMQP message with null header value

nandorsoma opened a new pull request, #6649:
URL: https://github.com/apache/nifi/pull/6649

   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-10760](https://issues.apache.org/jira/browse/NIFI-10760)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [x] Build completed using `mvn clean install -P contrib-check`
     - [x] JDK 8
     - [ ] JDK 11
     - [ ] JDK 17
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog closed pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog closed pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value
URL: https://github.com/apache/nifi/pull/6649


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on a diff in pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on code in PR #6649:
URL: https://github.com/apache/nifi/pull/6649#discussion_r1021806878


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/PublishAMQPTest.java:
##########
@@ -134,14 +124,10 @@ public void validateSuccessWithHeaderWithCommaPublishToSuccess() throws Exceptio
 
         final Map<String, Object> headerMap = msg1.getProps().getHeaders();
 
-        final Object foo = headerMap.get("foo");
-        final Object foo2 = headerMap.get("foo2");
-        final Object foo3 = headerMap.get("foo3");
-
-        assertEquals("(bar,bar)", foo.toString());
-        assertEquals("bar2", foo2.toString());
-        assertNull(foo3);
-
+        assertEquals(2, headerMap.size());
+        assertEquals("(bar,bar)", headerMap.get("foo").toString());

Review Comment:
   In these tests, is it possible we can use a pre-defined header map to compare these values?
   
   ```
       private static Map<String, String> EXPECTED_HEADERS  = new HashMap<String, String>() {{
           put("foo", "(bar,bar)");
           put("foo2", "bar2");
           put("foo3", null);
       }};
   ```
       
   And a method (something like assertExpectedHeaders(msg1.getProps().getHeaders() { ... }) to assert the header values match the above map?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on PR #6649:
URL: https://github.com/apache/nifi/pull/6649#issuecomment-1313944544

   Will review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on PR #6649:
URL: https://github.com/apache/nifi/pull/6649#issuecomment-1317657443

   Thanks Nandor, I verified PublishAMQP can publish null header values and then ConsumeAMQP will retrieve them an interpret them correctly. I also verified that a warning is thrown when 'Ignore Null Header = true' but suggested a change to the naming and usage. Otherwise, looks good to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on a diff in pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on code in PR #6649:
URL: https://github.com/apache/nifi/pull/6649#discussion_r1024497984


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java:
##########
@@ -108,10 +106,22 @@ public class PublishAMQP extends AbstractAMQPProcessor<AMQPPublisher> {
             .addValidator(StandardValidators.SINGLE_CHAR_VALIDATOR)
             .required(false)
             .build();
+
+    public static final PropertyDescriptor IGNORE_HEADER_WITH_NULL_VALUE = new PropertyDescriptor.Builder()

Review Comment:
   Currently with 'Ignore Null Header = true', the processor throws an error, which is a little counter-intuitive because we told the processor to ignore the null header but it throws a warning?
   
   Perhaps this would be better as 'Allow Null Header', and flipping the true/false condition, such that the warning message is thrown when 'Allow Null Header = false' and a null header is provided.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] nandorsoma commented on a diff in pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
nandorsoma commented on code in PR #6649:
URL: https://github.com/apache/nifi/pull/6649#discussion_r1024349399


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/PublishAMQPTest.java:
##########
@@ -134,14 +124,10 @@ public void validateSuccessWithHeaderWithCommaPublishToSuccess() throws Exceptio
 
         final Map<String, Object> headerMap = msg1.getProps().getHeaders();
 
-        final Object foo = headerMap.get("foo");
-        final Object foo2 = headerMap.get("foo2");
-        final Object foo3 = headerMap.get("foo3");
-
-        assertEquals("(bar,bar)", foo.toString());
-        assertEquals("bar2", foo2.toString());
-        assertNull(foo3);
-
+        assertEquals(2, headerMap.size());
+        assertEquals("(bar,bar)", headerMap.get("foo").toString());

Review Comment:
   Good idea, thanks @thenatog! I added a minor modification, though. I'm creating the maps locally because you cannot use the same map for both tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on a diff in pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on code in PR #6649:
URL: https://github.com/apache/nifi/pull/6649#discussion_r1024500229


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java:
##########
@@ -108,10 +106,22 @@ public class PublishAMQP extends AbstractAMQPProcessor<AMQPPublisher> {
             .addValidator(StandardValidators.SINGLE_CHAR_VALIDATOR)
             .required(false)
             .build();
+
+    public static final PropertyDescriptor IGNORE_HEADER_WITH_NULL_VALUE = new PropertyDescriptor.Builder()

Review Comment:
   The default value might also be 'true' to allow null headers by default? I'm actually not sure if there's a great reason not to allow null headers in the first place, so potentially this property isn't required.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] nandorsoma commented on pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
nandorsoma commented on PR #6649:
URL: https://github.com/apache/nifi/pull/6649#issuecomment-1311043445

   The branch name was correct, but I mistyped the ticket name in the commit message, hence the force push.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] nandorsoma commented on pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
nandorsoma commented on PR #6649:
URL: https://github.com/apache/nifi/pull/6649#issuecomment-1323350615

   Thank you @thenatog and @turcsanyip for your reviews! I've implemented the requested changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] turcsanyip commented on a diff in pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
turcsanyip commented on code in PR #6649:
URL: https://github.com/apache/nifi/pull/6649#discussion_r1024921650


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java:
##########
@@ -108,10 +106,22 @@ public class PublishAMQP extends AbstractAMQPProcessor<AMQPPublisher> {
             .addValidator(StandardValidators.SINGLE_CHAR_VALIDATOR)
             .required(false)
             .build();
+
+    public static final PropertyDescriptor IGNORE_HEADER_WITH_NULL_VALUE = new PropertyDescriptor.Builder()

Review Comment:
   I agree with @thenatog that the property is not necessary and allowing the `null` header could be the only work mode. We did not introduce extra property for ignoring null headers in `ConsumeAMQP` either ([NIFI-10317](https://issues.apache.org/jira/browse/NIFI-10317)).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] thenatog commented on pull request #6649: NIFI-10785 Allow publishing AMQP message with null header value

Posted by GitBox <gi...@apache.org>.
thenatog commented on PR #6649:
URL: https://github.com/apache/nifi/pull/6649#issuecomment-1331030789

   +1 will merge


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org