Search code examples
confluent-platformconfluent-schema-registryconfluent-cloud

Confluent cloud | Java Avro Serialization | junk characters in value


I am trying with basic Avro publisher in java which is available in examples

https://github.com/confluentinc/examples/blob/5.5.1-post/clients/avro/src/main/java/io/confluent/examples/clients/basicavro/ProducerExample.java

I was successfully able to publish in self managed confluent cloud in my local machine ( macOS ) and in machine available in GCP ( Self managed confluent binaries )

enter image description here

The same was tried it confluent cloud

I have a confluent cloud access, where i am trying with this same example but it is showing junk characters in value.

enter image description here

Steps carried out in confluent cloud

  1. Manually created a topic by name transactions
  2. Configuration file was created with following entries enter image description here
  3. Ran the java application by passing the absolute file path configuration.
  4. I am able to see the schema is also set in confluent cloud. enter image description here

Could any of you help me over here as what is missing.


Solution

  • Your data is correct; the Confluent Cloud message viewer doesn't currently (September 2020) support rendering Avro messages.

    You can verify that your data is correct by using a consumer such as kafkacat:

    docker run --rm edenhill/kafkacat:1.6.0 \
             -X security.protocol=SASL_SSL -X sasl.mechanisms=PLAIN \
             -X ssl.ca.location=./etc/ssl/cert.pem -X api.version.request=true \
             -b ${CCLOUD_BROKER_HOST} \
             -X sasl.username="${CCLOUD_API_KEY}" \
             -X sasl.password="${CCLOUD_API_SECRET}" \
             -t your_topic \
             -C -o beginning \
             -f 'Topic %t[%p], offset: %o, Headers: %h, key: %k, payload: %S bytes: %s\n ' \
             -s avro -r https://"${CCLOUD_SCHEMA_REGISTRY_API_KEY}":"${CCLOUD_SCHEMA_REGISTRY_API_SECRET}"@${CCLOUD_SCHEMA_REGISTRY_URL}