spring-cloud / spring-cloud/spring-cloud-stream

discrepancy between kafka and rabbitmq binder

Open
#2,185 6 comments 0 reactions 2 assignees View on GitHub

@olegz is already working on this.

Since Jul 27, 2021.

waiting-on-feedback
Dominant language
Java
Stars
1.1k
Forks
646
Avg merge
2d 3h
Merged PRs (30d)
8

Description

Describe the issue
When I send a message with a header containing an UUID, it is received on the other end as an UUID with the kafka binder, but as a String with the rabbitmq binder. This causes code that checks for equality to fail.

To Reproduce
Send

MessageBuilder.withPayload("").setHeader("foo", UUID.randomUUID());

Receive

"8554052e-da16-4f83-a152-3f083d238386".equals(message.getHeaders().get("foo")) // works with rabbitmq, doesn't work with kafka

Version of the framework 3.0.3.RELEASE
Expected behavior
The default simple code should behave the same accross binders

Additional context
To fix this, I know I can use

"8554052e-da16-4f83-a152-3f083d238386".equals(message.getHeaders().get("foo").toString()) // toString workaround

but this is a workaround for the fact that I don't get the same object across binders. Should they all return an UUID because that's what I sent ? Or a String because the sender should have called toString() on the input ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.