themanifold commented on pull request #4552:
URL: https://github.com/apache/nifi/pull/4552#issuecomment-700503064


   > @themanifold Could you please clarify your use case and the problem you 
would like to solve in more detail?
   > 
   > If I understand correctly, `ConsumeAMQP` can emit the following 
`amqp$headers` attribute values (as strings):
   > 
   >     * `{a=1}` if there is 1 key=value pair in the message headers
   > 
   >     * `{a=1,b=2}` if there are 2 key=value pairs in the headers of the 
received message
   > 
   >     * `{}` if the headers of the received message is empty
   > 
   > 
   > And you would like `PublishAMQP` to be able to parse these strings 
properly. Eg. in case of `{a=1,b=2}`, remove the curly braces and add 2 headers 
(`a=1` and `b=2`), and in case of `{}`, no headers need to be added.
   > 
   > So your flow is `ConsumeAMQP` (from a queue) => process data => 
`PublishAMQP` (to another queue with keeping the same headers). Is my 
understanding correct?
   
   Everything here is correct apart from the flow. My initial attempt in NiFi 
didn't actually do any data processing. I did: `ConsumeAMQP` (from a queue) => 
`PublishAMQP` (exchange). If you try this in NiFi, you'll find that the 
`PublishAMQP` can't cope with `{}` (if your incoming message has no headers). 
Additionally, you'll see that `ConsumeAMQP` actually can't cope with curly 
braces full stop and will end up making some invalid headers - specifically the 
first key and the last key will have `{` and `}` appended and prepended, 
respectively. When I say that it can't cope, I mean that throws up a warning 
that will obscure any real errors.
   
   My work around right now is to actually delete the empty header using the 
`update attribute` processor.
   
   


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


Reply via email to