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

fix(microservices): prevent kafka parser from modifying received message #9996

Merged
merged 2 commits into from Jul 28, 2022

Conversation

jDzames
Copy link
Contributor

@jDzames jDzames commented Jul 21, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Kafka parser modifies messages during parsing. If a message handler fails and message is retried by KafkaJS, then the already parsed message is parsed again and the value ends up being the string '[object Object]'.

Issue Number: 9956

What is the new behavior?

Kafka parser duplicates message objects and puts parsed data into these newly created objects. So retries are executed with the same data.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

fix: #9956

@coveralls
Copy link

coveralls commented Jul 21, 2022

Pull Request Test Coverage Report for Build 85dd6edf-0e26-4af1-a38d-30d84abbec45

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0009%) to 94.024%

Totals Coverage Status
Change from base Build 8ef0dd2b-a478-4378-b9d0-9a314f70870c: 0.0009%
Covered Lines: 6057
Relevant Lines: 6442

💛 - Coveralls

@jDzames
Copy link
Contributor Author

jDzames commented Jul 21, 2022

(lint failure is caused by var CompressionCodecs in kafka.interface.ts, it was there already - do we want to do sth about it?)
EDIT: lint failure fixed (rebased branch)

@Tony133
Copy link
Contributor

Tony133 commented Jul 21, 2022

Hi @jDzames, CompressionCodecs in kafka.interface.ts, has been fixed in this PR #9991

@kamilmysliwiec
Copy link
Member

LGTM

@kamilmysliwiec kamilmysliwiec merged commit a1aeba6 into nestjs:master Jul 28, 2022
@jDzames jDzames deleted the fix/kafka-parser-retries branch July 28, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kafka microservice server - parser modifies original message, which breaks retries
4 participants