markap14 commented on PR #6131:
URL: https://github.com/apache/nifi/pull/6131#issuecomment-1222894569
Thanks for updating @greyp9 . Trying this out again.
I just tried sending the following content via PublishKafkaRecord_2_6:
```
{
"key": {
"type": "person"
},
"value": {
"name": "Mark",
"number": 49
},
"headers": {
"headerA": "headerAValue"
}
}
```
I set Publish Strategy to "Use Wrapper" and used a JsonTreeReader as the
record reader.
But I encountered a NullPointerException:
```
2022-08-22 15:58:22,792 ERROR [Timer-Driven Process Thread-2]
o.a.n.p.k.pubsub.PublishKafkaRecord_2_6
PublishKafkaRecord_2_6[id=c71d2b54-0182-1000-4979-53ab4cc8d555] Failed to send
StandardFlowFileRecord[uuid=e8d03807-fa13-4620-be6a-72e014ac0838,claim=StandardContentClaim
[resourceClaim=StandardResourceClaim[id=1661197835339-1, container=default,
section=1], offset=3200,
length=145],offset=0,name=e8d03807-fa13-4620-be6a-72e014ac0838,size=145] to
Kafka
java.lang.NullPointerException: null
at
org.apache.nifi.processors.kafka.pubsub.PublisherLease.toWrapperRecord(PublisherLease.java:262)
at
org.apache.nifi.processors.kafka.pubsub.PublisherLease.publish(PublisherLease.java:210)
at
org.apache.nifi.processors.kafka.pubsub.PublishKafkaRecord_2_6$1.process(PublishKafkaRecord_2_6.java:521)
at
org.apache.nifi.controller.repository.StandardProcessSession.read(StandardProcessSession.java:2693)
at
org.apache.nifi.controller.repository.StandardProcessSession.read(StandardProcessSession.java:2661)
at
org.apache.nifi.processors.kafka.pubsub.PublishKafkaRecord_2_6.onTrigger(PublishKafkaRecord_2_6.java:513)
at
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1357)
at
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:246)
at
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:102)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.base/java.lang.Thread.run(Unknown Source)
```
One other thing that I noticed, though it's minor: When I change the
"Publish Strategy" to "Use Wrapper" I'm given the option to configure the
"Record Key Writer" property. But this is way down the list, about 8 or 10
properties down, so it's not at all obvious that it's made available. Probably
want to move the "Record Key Writer" just after the "Publish Strategy" property
sends it depends on it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]