Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Offset Increment of 2 Per Message in Single-Partition Kafka Topic #549

Open
vcanuel opened this issue Dec 27, 2024 · 2 comments

Comments

@vcanuel
Copy link

vcanuel commented Dec 27, 2024

Description:

Hi,

I’ve encountered an issue where, after writing messages to a Kafka topic with a single partition, the offsets increment by 2 instead of the expected increment of 1. For example, the sequence of offsets is 0, 2, 4, etc.
Is this normal ?

Basic information

  • Axon Framework version: 4.10.2

  • JDK version: 21

  • Kafka Extension version: 4.10.0

  • My application properties :

axon.kafka.publisher.confirmation-mode=transactional
axon.kafka.bootstrap-servers=localhost:9092
axon.kafka.message-converter-mode=default
axon.kafka.client-id=anonymous
axon.kafka.default-topic=axon-events
axon.kafka.publisher.confirmation-mode=wait_for_ack
axon.kafka.producer.transaction-id-prefix=axontx
axon.kafka.producer.retries=1
axon.kafka.producer.event-processor-mode=subscribing
axon.kafka.producer.acks=all

Steps to Reproduce:

  1. Produce messages to a Kafka topic configured with a single partition.
  2. Observe the offsets assigned to each message.

Expected Behavior:

Offsets should increment by 1 for each new message (e.g., 0, 1, 2, 3, …).

Actual Behavior:

Offsets increment by 2 for each new message (e.g., 0, 2, 4, …).

@smcvb
Copy link
Member

smcvb commented Dec 30, 2024

Thanks for filing this concern with us, @vcanuel.
Although this might be asking a lot, I am going to regardless: would you mind trying to reproduce this offset-issue with the example present in this repository?
The example resides in the "kafka-axon-example" folder, by the way.
Sharing a reproducible will help us quite a bit to ensure nothing gets lost in translation.

@vcanuel
Copy link
Author

vcanuel commented Dec 30, 2024

Hi @smcvb,

I have run the Axon example without any issues.

I have pinpointed the problem: it occurs when the confirmation mode is set to transactional:

  kafka:
    publisher:
      confirmation-mode: transactional
    clientid: kafka-axon-example
    producer:
      retries: 1
      bootstrap-servers: localhost:29092
      transaction-id-prefix: axontx

CleanShot 2024-12-30 at 14 35 26@2x

Is this normal ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants