You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "olivierdeckers (via GitHub)" <gi...@apache.org> on 2023/06/21 16:10:00 UTC
[GitHub] [camel-kafka-connector] olivierdeckers opened a new issue, #1542: CamelKafkasslsinkSinkConnector not handling binary payloads well
olivierdeckers opened a new issue, #1542:
URL: https://github.com/apache/camel-kafka-connector/issues/1542
Hello! I am trying to use the CamelKafkasslsinkSinkConnector to move a binary payload from one kafka cluster to another. Messages are being produced on the target cluster, but they payload is not completely identical. I discovered this is because the connectors' kafka producer is using StringSerializer as value.serializer. It logs: `value.serializer = class org.apache.kafka.common.serialization.StringSerializer
(org.apache.kafka.clients.producer.ProducerConfig:376)`
I configured the connector like this:
```
{
"camel.idempotency.enabled": "false",
"camel.kamelet.kafka-ssl-sink.bootstrapServers": "localhost:9094",
"camel.kamelet.kafka-ssl-sink.sslKeyPassword": "...",
"camel.kamelet.kafka-ssl-sink.sslKeystoreLocation": "...",
"camel.kamelet.kafka-ssl-sink.sslKeystorePassword": "...",
"camel.kamelet.kafka-ssl-sink.sslTruststoreLocation": "...",
"camel.kamelet.kafka-ssl-sink.topic": "target-topic",
"camel.map.headers": "true",
"camel.map.properties": "true",
"connector.class": "org.apache.camel.kafkaconnector.kafkasslsink.CamelKafkasslsinkSinkConnector",
"errors.deadletterqueue.context.headers.enable": "false",
"errors.log.enable": "true",
"errors.log.include.messages": "false",
"header.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
"key.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
"name": "camel-kafka-ssl-sink-connector-test",
"topics": "source-topic",
"value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter"
}
```
I cannot find in the documentation how to configure the value.serializer config used for creating the kafka producer. I also tried adding a couple of things to the connector config, like: producer.override.value.serializer, producer.value.serializer, value.serializer, ...
but none of them seem to have any effect.
Is it possible to configure this? Shouldn't the producer default to ByteArrayConverter to make sure the connector can handle both text and binary payloads?
--
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: commits-unsubscribe@camel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] CamelKafkasslsinkSinkConnector not handling binary payloads well [camel-kafka-connector]
Posted by "oscerd (via GitHub) via commits" <co...@camel.apache.org>.
oscerd commented on issue #1542:
URL: https://github.com/apache/camel-kafka-connector/issues/1542#issuecomment-6632218420
jakubmalek's answer above is still the way to do this. The kafka-ssl-sink connector was replaced in 4.18.0 by camel-kafka-sink-kafka-connector (`org.apache.camel.kafkaconnector.kafkasink.CamelKafkasinkSinkConnector`), configured with `camel.kamelet.kafka-sink.saslAuthType=SSL` and the `camel.kamelet.kafka-sink.ssl*` options. Its producer still defaults to `StringSerializer`, so for binary payloads add `camel.component.kafka.valueSerializer=org.apache.kafka.common.serialization.ByteArraySerializer` next to `value.converter=org.apache.kafka.connect.converters.ByteArrayConverter`; in a quick check with the 4.22.0 jars this delivered the bytes unchanged, while the default replaced the non-UTF-8 bytes. Closing this as answered; if payloads are still altered on 4.22.x, please open a new issue with the version, connector config and a sample record.
---
_Claude Code on behalf of Andrea Cosentino_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-kafka-connector] jakubmalek commented on issue #1542: CamelKafkasslsinkSinkConnector not handling binary payloads well
Posted by "jakubmalek (via GitHub)" <gi...@apache.org>.
jakubmalek commented on issue #1542:
URL: https://github.com/apache/camel-kafka-connector/issues/1542#issuecomment-1657830394
Hi @olivierdeckers, the `producer.override` setting are only applicable to the Source connectors, that produce data into the topics. In here you're using Sink connector, where converters are used to deserialize the `ConsumerRecord` into `SinkRecord` which can be later transformed before it's passed to the plugin.
If you need to configure the producer used internally by the plugin, you need to look at configuration properties for [camel-kafka](https://github.com/apache/camel/tree/main/components/camel-kafka) component.
You can find list of component properties in [here](https://github.com/apache/camel/blob/main/components/camel-kafka/src/generated/resources/org/apache/camel/component/kafka/kafka.json#L24) for example.
The properties for the component can be specified with `camel.component.$componentName` prefix in your case `camel.component.kafka`.
As I see by default the `camel.component.kafka.valueSerializer` is set to `org.apache.kafka.common.serialization.StringSerializer` which might explain the problem.
You may also consider using MirrorMaker2 connector, available by default in Kafka. Although it does little bit more than simply producing the data, as it also synchronizes Kafka topic partitions.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] CamelKafkasslsinkSinkConnector not handling binary payloads well [camel-kafka-connector]
Posted by "oscerd (via GitHub) via commits" <co...@camel.apache.org>.
oscerd closed issue #1542: CamelKafkasslsinkSinkConnector not handling binary payloads well
URL: https://github.com/apache/camel-kafka-connector/issues/1542
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org