Skip to content

fix(produce): report only successfully produced messages on failure - #342

Open
jakubdyszkiewicz wants to merge 1 commit into
deviceinsight:mainfrom
jakubdyszkiewicz:fix/produced-message-count-on-error
Open

jakubdyszkiewicz wants to merge 1 commit into
deviceinsight:mainfrom
jakubdyszkiewicz:fix/produced-message-count-on-error

Conversation

@jakubdyszkiewicz

Copy link
Copy Markdown

Description

Hey 👋

I noticed that when I violate broker policy (placed by my proxy) I get the following message

1 messages produced
Failed to produce message: kafka server: Request parameters do not satisfy the configured policy

I reproduced it with producing a message that's too big.
It seems that the produce command incremented the message counter before sending, so a failed send was included in the count.

Fixes # (issue)

^ should I create issue first?

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Documentation

No new docs. It's just a fix

  • the change is mentioned in the ## [Unreleased] section of CHANGELOG.md
  • the configuration yaml was changed and the example config in README.adoc was updated
  • a usage example was added to README.adoc
  • tests for the changes have been implemented (see: Testing your changes)

The produce command incremented the message counter before sending, so a
failed send was included in the count. On error the command printed
'N messages produced' with the failed message included, even though the
message was rejected by the broker and never stored.

Move the counter increment after a successful SendMessage so the count
only includes produced messages. Add an integration test that produces a
message larger than the broker's message.max.bytes and asserts
'0 messages produced' on failure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant