schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

kafka-avro-console-consumer not honoring print.offset, print.partition, or print.headers

Open llmcgovern opened this issue 3 years ago • 5 comments

--property print.offset=true --property print.partition=true --property print.headers=true

all of these properties are ignored by kafka-avro-console-consumer

llmcgovern avatar Jun 23 '21 16:06 llmcgovern

They aren't accepted, not "ignored"

ref. https://github.com/confluentinc/schema-registry/blob/master/schema-serializer/src/main/java/io/confluent/kafka/formatter/SchemaMessageFormatter.java#L46-L50

OneCricketeer avatar Jun 24 '21 23:06 OneCricketeer

Ok, but kafka-console-consumer does accept them.

llmcgovern avatar Jun 24 '21 23:06 llmcgovern

Last I checked, there was no easy way to extend the DefaultMessageFormatter to accept the same fields. without duplicating all the same checks and property extraction.
That may have changed after https://github.com/apache/kafka/commit/c77183dbb323d1aa4b72ebcfedeac9947c3c76d0

OneCricketeer avatar Jun 25 '21 00:06 OneCricketeer

help seems to indicate it accepts these parameters , however offset is not printed

kafka-avro-console-consumer --help This tool helps to read data from Kafka topics and outputs it to standard output. Option Description


--bootstrap-server <String: server to REQUIRED: The server(s) to connect to. connect to> specified. --property <String: prop> The properties to initialize the message formatter. Default properties include: print.timestamp=true|false print.key=true|false print.offset=true|false print.partition=true|false print.headers=true|false

dibyajyotibehera avatar Apr 13 '22 12:04 dibyajyotibehera

Is there any update on this? I'm using 7.2.1 and the issue seems to still be there.

doug25252 avatar Aug 18 '22 15:08 doug25252

Hello...

I'm testing with 7.4.1 ... when consuming messages with headers (produced with kafka-avro-console-producer) I can see the headers properly with the standard 'kafka-console-consumer' (and in C3) but the 'kafka-avro-console-consumer' displays "null" for the values of the header keys...

Using "kafka-avro-console-consumer" image image

But "kafka-console-consumer" image

DennisFederico avatar Jul 31 '23 18:07 DennisFederico

Try adding --property headers.deserializer=org.apache.kafka.common.serialization.StringDeserializer

rayokota avatar Jul 31 '23 19:07 rayokota