-
Notifications
You must be signed in to change notification settings - Fork 440
#1229 Allow return null in kafka Serializer (delete messages aka Tombstones) #1230
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
Conversation
...es aka Tombstone)
565698f
to
09afec8
Compare
There are some errors in automated tests like:
1) Enqueue\Wamp\Tests\Functional\WampConsumerTest::testShouldSendAndReceiveMessage
Error: Call to undefined function GuzzleHttp\Psr7\uri_for()
/mqdev/vendor/ratchet/pawl/src/Connector.php:126
/mqdev/vendor/ratchet/pawl/src/Connector.php:38
/mqdev/vendor/thruway/pawl-transport/src/PawlTransportProvider.php:59
/mqdev/vendor/thruway/client/src/Peer/Client.php:230
/mqdev/pkg/wamp/WampConsumer.php:96
/mqdev/pkg/wamp/Tests/Functional/WampConsumerTest.php:36
/mqdev/pkg/test/RetryTrait.php:26
phpvfscomposer:///mqdev/vendor/phpunit/phpunit/phpunit:97
But that looks like can't be introduced by my change. Could it be possible just restart failed actions?
Seems like too high version of guzzle/psr7
is used (2.1.0) and we are using some deprecated functions - or rather, they were not upgraded.
See https://github.com/guzzle/psr7#upgrading-from-function-api.
And yeah, it's outside of the scope of change.
EDIT: It seems to be coming from external library, https://github.com/ratchetphp/Pawl.
EDIT2: ratchet/pawl
is installed in version 0.3.5
, 0.4.0
is has this "fixed".
@Steveb-p, thank you for the answer.
And yeah, it's outside of the scope of change.
So, could you please review the change itself? That is very simple I think.
pkg/rdkafka/JsonSerializer.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer early return for readability:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not true, and it would not match with the Stringable
interface that is part of PHP8.
See https://www.php.net/manual/en/class.stringable.php.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But Serializer
does not extend Stringable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Stringable defines interface public __toString(): string
method with two underscores in name, not toString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString
should always return a string, especially since it's based on RdKafkaMessage
and can be thought of as an implementation of Stringable
.
Otherwise I have no further comments, and it looks good to me.
@Steveb-p, Stringable
interface defines public __toString(): string
method with two underscores in name, not toString
. And Serializer
does not extend Stringable
. Why you are speaking about it?
That is the main change in that pull request. Without it, there is not possible to write into a topic null value. Is not?
@Hubbitus I kinda assumed it was, my mistake.
@Steveb-p, no problem.
Can we then continue the review please?
Guys, could we please continue?
That is a quite trivial change I think. But very important.
Guys, could we please continue? That is a quite trivial change I think. But very important.
Actually, it's not trivial. It breaks the contract for the interface, so semver would dictate that it should have a major version bump. Unfortunately the enqueue library, similarly to Symfony, has a shared version across all packages, so it's not exactly acceptable to just bump this one package and not the rest.
If it were to be released as a minor version, it would cause people that update to have broken builds / applications, so there is probably no solution that covers both your need (of a new functionality, kinda) and dependent applications that do have their own serializers.
Do you need this for your own application, or is it for your own library that is re-used by others? If it's an application or internal library, then I suggest you overwrite the dependency with your own fork or rely on your own fork with replace
entry, so it "overwrites" the enqueue.
I hope that a new major version of enqueue is released eventually, but given the current state of the package (makasim, the owner, is currently occupied with projects in other languages and is not actively maintaining the lib) I cannot with good conscience promise that. It's something that probably will need to be discussed outside of this PR.
If you need any help with package overwriting, I'll be glad to help.
Hello.
Not introducing API/ABI breakage is a very important point, I agree. Probably indeed that can't be made in a minor version update. But what is wrong with creating new major version, list that as incompatible change (probably single), and encouraging others to step to that new version?
Symfony eventually also should update their dependencies. And said after some time (3-12 months) just drop support of current major version.
Thanks for the links about forks, of course, I already was thinking about that, but it looks like just some temporary workaround rather than the solution (in any update I will be forced to do puls, re-bases, and my releases...).
@Hubbitus the issue is that enqueue has a shared versioning, so introducing a single break should result in bumps in all packages. Which don't have any breaking changes atm (due to no small part the fact that some are simply not actively maintained).
Personally, I don't mind, but I'm technically not the owner and I cannot make statements if and when a major version bump will be done.
@makasim ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@makasim, could you please look on it? Is it possible to merge that and create a new version?
Closes #1229