markap14 commented on a change in pull request #3439: NIFI-6218 Support setting
transactional.id in PublishKafka/PublishKaf…
URL: https://github.com/apache/nifi/pull/3439#discussion_r277295284
##########
File path:
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-0-11-processors/src/test/java/org/apache/nifi/processors/kafka/pubsub/TestPublisherPool.java
##########
@@ -65,5 +70,40 @@ public void testPoisonedLeaseNotReturnedToPool() {
lease.close();
assertEquals(0, pool.available());
}
+ @Test
+ public void testUseTransactionWithUUID() {
+ final Map<String, Object> kafkaProperties = new HashMap<>();
+ kafkaProperties.put("bootstrap.servers", "localhost:1111");
+ kafkaProperties.put("key.serializer",
ByteArraySerializer.class.getName());
+ kafkaProperties.put("value.serializer",
ByteArraySerializer.class.getName());
+ final PublisherPool pool = new PublisherPool(kafkaProperties,
Mockito.mock(ComponentLog.class), 1024 * 1024, 1000L, true, null, null,
StandardCharsets.UTF_8);
+ PublisherLease publisherLease = pool.obtainPublisher();
+
+ Producer producer = (Producer)
Whitebox.getInternalState(publisherLease, "producer");
Review comment:
If the transaction id is needed for testing purposes, we should expose a
`getTransactionalId()` method on the `PublisherLease` object (at protected or
package-private level). I would avoid using reflection to access internal
member variables.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services