0

Is it possible to consume only a specific number of messages like 10 or 50 or 100 messages from the 1000 that are in the queue? I was looking at 'fetch.max.bytes' config, but it seems like it is for a message size rather than number of messages.

I don't know how to set "max.partition.fetch.bytes" as my byte size is not the same in every message.

Is there a way to dynamically set this to read 10 or 50 or 100 messages per minute?

Or is there any way I can do this?

note : please "max.poll.records" note that I cannot use the method

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Gülsen Keskin
  • 657
  • 7
  • 23

1 Answers1

1

Per minute? No, not really, because you have little control as a consumer client over producer speeds or even network speeds.

If you just want a static number, seek the consumer to a specific partition offset and simply count the number of records consumed until you're satisfied with the number, then commit the offsets back (or don't).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245