You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "loguylo (via GitHub)" <gi...@apache.org> on 2026/07/09 22:05:07 UTC

[PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

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

   <!-- 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-16097](https://issues.apache.org/jira/browse/NIFI-16097)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   - Pull request contains [commits signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) with a registered key indicating `Verified` status
   
   ### Pull Request Formatting
   
   - Pull Request based on current revision of the `main` branch
   - 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
   
   - [ ] Build completed using `./mvnw clean install -P contrib-check`
     - [ ] JDK 21
     - [ ] JDK 25
   
   ### 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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "loguylo (via GitHub)" <gi...@apache.org>.
loguylo commented on code in PR #11413:
URL: https://github.com/apache/nifi/pull/11413#discussion_r3559021389


##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/PublishKafka.java:
##########
@@ -140,6 +140,19 @@ public class PublishKafka extends AbstractProcessor implements VerifiableProcess
             .defaultValue(DeliveryGuarantee.DELIVERY_REPLICATED)
             .build();
 
+    static final PropertyDescriptor ENABLE_IDEMPOTENCE = new PropertyDescriptor.Builder()
+            .name("enable.idempotence")
+            .displayName("Enable Idempotence")
+            .description("Specifies whether the producer will ensure that exactly one copy of each message is written in the stream. " +
+                    "If set to ‘false’, producer retries due to broker failures, etc., may write duplicates of the retried message in the stream. " +
+                    "Corresponds to Kafka Client enable.idempotence property.")

Review Comment:
   Replaced the usage of string concatenation with a multiline string.



-- 
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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "loguylo (via GitHub)" <gi...@apache.org>.
loguylo commented on PR #11413:
URL: https://github.com/apache/nifi/pull/11413#issuecomment-4948710446

   After further research, it seems like the correct behavior is shown here. Based on the documentation, the `enable.idempotence `property of the kafka producer should be blocked behind the constraint that `acks=all `(`DELIVERY_GUARANTEE=DELIVERY_REPLICATED`). Furthermore, transactions should be locked behind the constraint that `enable.idempotence` is set to `true`. 
   
   It means that `enable.idempotence` should be set to false unless `acks=all`. if `acks=all` we can let the user choose whether he wants to set `enable.idempotence` to be `true`/`false`. Additionally, transactions should be turned off, unless `enable.idempotence` is set to `true`. in that case, we can let the user choose whether he wants to use transactions or not. 
   
   The current implementation simply asks the user to disable transactions if acks!=all. 
   
   I believe the structure should look like that - 
   ```java
   ENABLE_IDEMPOTENCE = PropertyDescriptor.Builder()
       .dependsOn(DELIVERY_GUARANTEE, DeliveryGuarantee.DELIVERY_REPLICATED);
       
   TRANSACTIONS_ENABLED = new PropertyDescriptor.Builder()
       .dependsOn(ENABLE_IDEMPOTENCE, "true");
       
   TRANSACTIONAL_ID_PREFIX = new PropertyDescriptor.Builder()
       .dependsOn(TRANSACTIONS_ENABLED, "true");
   ```
   
   This also means that the deafult value of `ENABLE_IDEMPOTENCE` and the default value of `TRANSACTIONS_ENABLED` should be set to false, in order to avoid conflicting configurations 
   
   What do you think?


-- 
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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "loguylo (via GitHub)" <gi...@apache.org>.
loguylo commented on PR #11413:
URL: https://github.com/apache/nifi/pull/11413#issuecomment-4950271129

   Forgot to mention, the default values of these properties should also change, so the default values of `enable.idempotence` and enable transactions shoud be set to false.


-- 
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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #11413:
URL: https://github.com/apache/nifi/pull/11413#issuecomment-4960504479

   Thanks for evaluating the options @loguylo. The proposal to set `enable.idempotence` to `false` by default, and add the dependent checks on the other properties looks like a good way forward.


-- 
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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #11413:
URL: https://github.com/apache/nifi/pull/11413#discussion_r3555686790


##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/PublishKafka.java:
##########
@@ -140,6 +140,19 @@ public class PublishKafka extends AbstractProcessor implements VerifiableProcess
             .defaultValue(DeliveryGuarantee.DELIVERY_REPLICATED)
             .build();
 
+    static final PropertyDescriptor ENABLE_IDEMPOTENCE = new PropertyDescriptor.Builder()
+            .name("enable.idempotence")
+            .displayName("Enable Idempotence")
+            .description("Specifies whether the producer will ensure that exactly one copy of each message is written in the stream. " +
+                    "If set to ‘false’, producer retries due to broker failures, etc., may write duplicates of the retried message in the stream. " +
+                    "Corresponds to Kafka Client enable.idempotence property.")

Review Comment:
   A multiline string can be used instead of string concatenation for the description



-- 
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


Re: [PR] NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor [nifi]

Posted by "loguylo (via GitHub)" <gi...@apache.org>.
loguylo closed pull request #11413: NIFI-16097 Added enable.idemotence Option in Publish Kafka Processor
URL: https://github.com/apache/nifi/pull/11413


-- 
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