[ 
https://issues.apache.org/jira/browse/CAMEL-12654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550831#comment-16550831
 ] 

Prakhar commented on CAMEL-12654:
---------------------------------

Consider this scenario.

System A produces a message (For example Customer submitting his electric meter 
reading) to rabbitmq exchange. This message is passed in sequence through 3 
systems
--> System 1 (performs a check if submitted through the Online interface)
     --> Adds header (Online : <online-case-id>/null)
--> System 2 (more checks...)
     --> Adds header (PreviousBalance : <some_id>/null)
--> System 3 (more chesks)
     --> Adds header (ClearByInvoiceService : <some_other_id>/null)
...
...
...
--> System B
    --> Does final processing

System B processes this message. If either of the headers is set, it does a 
microservice lookup to get more details to enrich the base message. This works 
fine until we started reading the message from another system C. System C can 
directly send this message to System B, but it needs to setup headers with a 
null value.

So far we have been using a set of POJO based rabbit-mq consumers and producers 
to read messages and do ETL operations. Now we have started porting many of our 
integrations to apache camel, but we are not able to use camel-rabbitmq 
component, because headers with null values are skipped. It would be good to 
have camel-rabbitmq not to filter out the header with null values like the 
original rabbitmq java-client does.

Another factor which adds to the complexity is, there are multiple systems 
similar to System A, owned by different IT teams (and different programming 
languages). Making changes to System B would mean breaking message structure 
for rest of the parties which is additional cost and effort.

We can actually fork the camel-rabbitmq component and fix the changes. But that 
would mean, we have to maintain this fork for all the versions that we would 
use.

> RabbitMQ Headers - Headers with null value are skipped.
> -------------------------------------------------------
>
>                 Key: CAMEL-12654
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12654
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-rabbitmq
>    Affects Versions: 2.21.1
>            Reporter: Prakhar
>            Priority: Minor
>              Labels: headers, rabbitmq
>
> Reference: Conversation with Claus Ibsen on 
> [Stackoverflow|https://stackoverflow.com/questions/50583749/apache-camel-how-to-setheader-value-as-null]
> org.apache.camel.component.rabbitmq.RabbitMQMessageConverter.buildProperties()
>  skips the headers which have value null. The actual java client for RabbitMQ 
> does not have this check. It accepts a basic Map<String,Object> which can 
> accept null value. 
> [Reference|https://rabbitmq.github.io/rabbitmq-java-client/api/current/com/rabbitmq/client/AMQP.BasicProperties.Builder.html]
>  . Check the definition of headers() method
> *The business scenario where we use it*. On the RabbitMQ, we accept messages 
> from multiple sources. Depending on whether a specific header is null or not, 
> we route these message downstream in our processing pipeline.
> If required, I could provide a working example of rabbitmq java-client to 
> demonstrate that the headers with null value are not skipped



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to