-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
camel-elasticsearch-rest-kafka-connector indexId #1192
Comments
No, you can use the header. You just need to use the prefix "CamelHeader.", so it will be something like "CamelHeader.indexId" in case you're using the sink connector. So you'll need to add an header to your Kafka message with that name. |
Thanks for the response Andrea, I am setting this header before sending to kafka:
So you are saying it should be: ?
Is that right? |
Are you using the kafka-connect connector related to the component or something else? Because you should not use plain Camel code in case of Kafka connector usage, so I suspect your question is related to plain Camel. |
So we have some apps sending data to a few kafka topics and then we have a Kafka Connect cluster with camel-kafka-elastic sink connectors feeding data to elastic. |
If you have the are consuming from a kafka topic through the ES kafka connector sink, you'll need to have a kafka header in your Kafka record, named CamelHeader.indexId, this will be transformed before arriving the ES component to indexId only. |
Tried that already, I must be doing something weird. So, when I was sending a "indexId" header to the kafka topic, we had this message:
If I try to send the "CamelHeader.indexId" header, then nothing related with this exists.
I know it is a camel "issue", any ideas? 🤷🏼 |
What is the camel kafka connector version? |
camel-elasticsearch-rest-kafka-connector:0.7.1.fuse-800004-redhat-00001 |
For Red Hat product you need to ask to Red Hat support. |
By the way I'll have a look with the same 0.7.1 from upstream. Can you please show the kafka connector configuration too? |
Sure! By the way, we are using the Strimzi/AMQ streams operator
|
Hello @seravat
I assume you are sending to kafka using a traditional camel route?
It depends on how you produce event in the topic; the goal is that the produced event on the topic should have an Header named |
Yes, I am using a traditional camel route. It has a processor that sets that header and other stuff, then it uses the kafka component to send the message.
Maybe camel is removing the header when sending or kafka is ignoring when receiving. Can we send headers to kafka with the "string.string" notation? |
Yes, the default header filter strategy https://github.com/apache/camel/blob/b10d6be0bcb232c76402b200046c95552d1c488a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaHeaderFilterStrategy.java remove each header starting with So you should implement a custom I hope it makes sense, don't hesitate to further ask if not. |
Yes!!! Makes sense, I will test and share 🥇 |
It worked! Thanks for the help guys, very appreciated ⭐️ ⭐️ ⭐️ ⭐️ ⭐️ |
Hello,
According to the camel docs for the camel-elasticsearch-rest component: https://camel.apache.org/components/3.4.x/elasticsearch-rest-component.html
When using the Index operation, we can set the document id by using the header "indexId".
Is this header being ignored in the camel-elasticsearch-rest-kafka-connector ?
The text was updated successfully, but these errors were encountered: