Re: Extracting key-value pair from Produce Request API.

2025-01-21 Thread Chain Head
Apologies for disappearing. This is how I got it working. In hindsight, I should have known better and tried this first. byte[] keyBytes = new byte[record.keySize()]; record.key().get(keyBytes); byte[] valueBytes = new byte[record.valueSize()]; record.value().get(valueBytes); On Sun, Dec 29, 2024

Re: Extracting key-value pair from Produce Request API.

2024-12-28 Thread David Finnie
Hi Chain Head, Are you seeing any errors, or just getting empty strings for k and v? If you are seeing empty strings, it could well be that the ByteBuffer returned by Record.key() and Record.value() have their position set to the ByteBuffer's length. i.e. at the end of the ByteBuffer. Have y

Re: Extracting key-value pair from Produce Request API.

2024-12-27 Thread Greg Harris
Hi, I apologize for misunderstanding your initial email. Unfortunately I still don't understand your question. Could you clarify what result you expect from your code, and what the actual behavior is? Maybe also try and simplify the reproduction case. I see confusing use of a String constructor t

Re: Extracting key-value pair from Produce Request API.

2024-12-27 Thread Chain Head
Hi, I am looking at parsing Produce request API on broker side. This is for simulating a broker. No consumer is involved. Also, I am using 3.8.0. On Sat, 28 Dec, 2024, 04:47 Greg Harris, wrote: > Hi, > > Thanks for your question. > > It appears you're using the legacy consumer API, which was rem

Re: Extracting key-value pair from Produce Request API.

2024-12-27 Thread Chain Head
Hi, I am looking at parsing Produce request API on broker side. This is for simulating a broker. No consumer is involved. Also, I am using 3.8.0. On Sat, 28 Dec, 2024, 04:47 Greg Harris, wrote: > Hi, > > Thanks for your question. > > It appears you're using the legacy consumer API, which was rem

Re: Extracting key-value pair from Produce Request API.

2024-12-27 Thread Greg Harris
Hi, Thanks for your question. It appears you're using the legacy consumer API, which was removed in 2.0.0 and is no longer supported. I would strongly suggest building on top of the modern Java Consumer API at this time. The modern API exposes the deserialized headers via the ConsumerRecord#head