-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ZeroMQ: optional topic wrap #9197
Conversation
@alessiomatricardi Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@alessiomatricardi Thank you for signing the Contributor License Agreement! |
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.
Thank you for contribution!
Please, consider my review.
Plus it would be great to have some tests around these new options on the adapters.
And add your name to the @author
list of all the affected classes.
...romq/src/main/java/org/springframework/integration/zeromq/outbound/ZeroMqMessageHandler.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/outbound/ZeroMqMessageHandler.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/outbound/ZeroMqMessageHandler.java
Outdated
Show resolved
Hide resolved
Done! Let me know if now it's good |
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.
Also, please, take a look into zeromq.adoc
to mention these two new properties in respective places when we explain those channel adapter.
Thank you!
...eromq/src/main/java/org/springframework/integration/zeromq/dsl/ZeroMqMessageHandlerSpec.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/dsl/ZeroMqMessageProducerSpec.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/inbound/ZeroMqMessageProducer.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/inbound/ZeroMqMessageProducer.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/outbound/ZeroMqMessageHandler.java
Outdated
Show resolved
Hide resolved
...romq/src/main/java/org/springframework/integration/zeromq/outbound/ZeroMqMessageHandler.java
Outdated
Show resolved
Hide resolved
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.
Just one minor suggestion.
And, please, take a look into docs.
...romq/src/main/java/org/springframework/integration/zeromq/inbound/ZeroMqMessageProducer.java
Outdated
Show resolved
Hide resolved
Was just writing them :) |
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.
Something is off with tests:
ZeroMqMessageProducerTests > testMessageProducerForPubSubDisabledWrapTopic() FAILED
reactor.core.Exceptions$ReactorRejectedExecutionException at ZeroMqMessageProducerTests.java:188
Caused by: java.util.concurrent.RejectedExecutionException at ZeroMqMessageProducerTests.java:188
ZeroMqMessageProducerTests > testMessageProducerForPair() FAILED
reactor.core.Exceptions$ReactorRejectedExecutionException at ZeroMqMessageProducerTests.java:92
Caused by: java.util.concurrent.RejectedExecutionException at ZeroMqMessageProducerTests.java:92
ZeroMqMessageProducerTests > testMessageProducerForPubSubReceiveRaw() FAILED
org.zeromq.ZMQException at ZeroMqMessageProducerTests.java:100
Please, run locally ./gradlew :spring-integration-zeromq:check
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.
I'll merge this when you fix that my last comment in doc.
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.
Would you mind looking close to those tests:
ZeroMqMessageProducerTests > testMessageProducerForPubSubDisabledWrapTopic() FAILED
reactor.core.Exceptions$ReactorRejectedExecutionException at ZeroMqMessageProducerTests.java:188
Caused by: java.util.concurrent.RejectedExecutionException at ZeroMqMessageProducerTests.java:188
ZeroMqMessageProducerTests > testMessageProducerForPubSubReceiveRaw() FAILED
org.zeromq.ZMQException at ZeroMqMessageProducerTests.java:100
?
Looks like they are failing sporadically.
Perhaps they share some destinations or consumers. Or whatever, but as you see the build result is not stable.
Thanks
Still have one failing:
|
No. Still doesn't go through:
Sorry for being so annoying, but something is off with these new options or new tests. |
Don't worry! Seems that something strange occurs during destroying, I will look into it. It's strange because they work well on my side when I call |
thank you for contribution; looking forward for more! |
Fixes: #9197 * Update `ZeroMqMessageHandler` for `wrapTopic` option * Add author, fix code style, add same logic also for `ZeroMqMessageProducer` * Add `wrapTopic` function also in DSL specs * Fix wrap topic test: duplicate socket address caused binding exception * Rewrite the `MessageProducer.wrapTopic()` test * Call `stop()` instead of `destroy()` method (cherry picked from commit 80c8a61)
Fixes: #9197 * Update `ZeroMqMessageHandler` for `wrapTopic` option * Add author, fix code style, add same logic also for `ZeroMqMessageProducer` * Add `wrapTopic` function also in DSL specs * Fix wrap topic test: duplicate socket address caused binding exception * Rewrite the `MessageProducer.wrapTopic()` test * Call `stop()` instead of `destroy()` method (cherry picked from commit 80c8a61)
Fixes: spring-projects#9197 * Update `ZeroMqMessageHandler` for `wrapTopic` option * Add author, fix code style, add same logic also for `ZeroMqMessageProducer` * Add `wrapTopic` function also in DSL specs * Fix wrap topic test: duplicate socket address caused binding exception * Rewrite the `MessageProducer.wrapTopic()` test * Call `stop()` instead of `destroy()` method **Auto-cherry-pick to `6.3.x` & `6.2.x`**
When a topic is specified to the the ZeroMqMessageHandler, it sends a message with the following format
Frame 1: byte array of the topic
Frame 2: empty byte array
Frame 3: byte array representing the message payload
Is there a reason over this choice?
The official ZeroMQ documentation doesn't offer a clear view of the better approach which has to be followed, however it provides some code examples of how send/receive ZeroMQ packets.
Here an example (taken from here)
This example could suggest that no empty frames are needed, but choseable.
My PR addresses this issue (yes, for me this is a bug) keeping the default behaviour (wrap the topic with an additional empty ZeroMQ frame)