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

Message metadata propagation with ack and nack #2244

Merged
merged 5 commits into from
Dec 4, 2023

Conversation

ozangunalp
Copy link
Collaborator

@ozangunalp ozangunalp commented Aug 3, 2023

Currently, message composition does not propagate message metadata.
This makes message interception (through decorators etc.) practically unfeasible.

With this change Message acks and nacks receive an additional Metadata parameter.
Existing methods for acks/nacks and composition continue to work by delegating to the new ack/nack functions.
The Message interface from the api package is still compatible with the MP Messaging Spec Message interface, verified by the MessageSpecCompatibilityTest test.

Other changes related to message ack/nack composition :

  • Deprecate PublisherDecorator#decorate(String, String, boolean)
  • Introduce IncomingInterceptor
  • Change message interceptor method names:
    • OutgoingInterceptor#onMessage -> beforeMessageSend
    • IncomingInterceptor#afterMessageReceive
  • Message Observation API: Allows a MessageObservationCollector to observe message creation, acks, nacks, and message processing duration.

Resolves #334

@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2023

Codecov Report

Merging #2244 (6385b3d) into main (43d3c2d) will decrease coverage by 66.33%.
Report is 4 commits behind head on main.
The diff coverage is 1.81%.

❗ Current head 6385b3d differs from pull request most recent head eac70ac. Consider uploading reports for the commit eac70ac to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##               main    #2244       +/-   ##
=============================================
- Coverage     77.83%   11.50%   -66.33%     
+ Complexity     3700      459     -3241     
=============================================
  Files           301      301               
  Lines         12355    12416       +61     
  Branches       1580     1582        +2     
=============================================
- Hits           9617     1429     -8188     
- Misses         2018    10802     +8784     
+ Partials        720      185      -535     
Files Changed Coverage Δ
...lipse/microprofile/reactive/messaging/Message.java 0.00% <0.00%> (-88.10%) ⬇️
.../smallrye/reactive/messaging/amqp/AmqpMessage.java 0.00% <ø> (-95.30%) ⬇️
...e/reactive/messaging/amqp/OutgoingAmqpMessage.java 0.00% <ø> (-78.27%) ⬇️
...e/reactive/messaging/gcp/pubsub/PubSubMessage.java 0.00% <ø> (ø)
...rye/reactive/messaging/jms/IncomingJmsMessage.java 0.00% <ø> (-47.37%) ⬇️
.../reactive/messaging/kafka/IncomingKafkaRecord.java 72.50% <ø> (-25.00%) ⬇️
...ve/messaging/kafka/impl/ReactiveKafkaConsumer.java 55.40% <0.00%> (-27.01%) ⬇️
.../reactive/messaging/mqtt/ReceivingMqttMessage.java 0.00% <ø> (-73.34%) ⬇️
...ye/reactive/messaging/mqtt/SendingMqttMessage.java 0.00% <ø> (-100.00%) ⬇️
...saging/providers/OutgoingInterceptorDecorator.java 0.00% <0.00%> (-100.00%) ⬇️
... and 3 more

... and 242 files with indirect coverage changes

@ozangunalp ozangunalp added the core label Aug 8, 2023
@ozangunalp ozangunalp force-pushed the message_composability branch 2 times, most recently from 99b1266 to 3c634a3 Compare October 13, 2023 10:34
cescoffier
cescoffier previously approved these changes Oct 16, 2023
Copy link
Contributor

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few words of caution:

  • We need to make sure that the previous methods (where the ack is a function taking no parameter is still supported)
  • We need to make sure we pass the TCK.

@ozangunalp
Copy link
Collaborator Author

This is the reason I didn't push this faster.
TCK pass, and existing Message tests as well. But I want to take some time to check the test coverage and see which cases are covered.

@ozangunalp ozangunalp force-pushed the message_composability branch 2 times, most recently from da7c5b2 to 57eb20c Compare November 30, 2023 23:04
@ozangunalp ozangunalp marked this pull request as ready for review December 1, 2023 08:35
@cescoffier
Copy link
Contributor

The commits might need to be refactored a bit.

cescoffier
cescoffier previously approved these changes Dec 1, 2023
OutgoingInterceptor#onMessage deprecated and replaced by OutgoingInterceptor#beforeMessageSend
Decorator to allow defining an observation collector to observe message acks, nacks and completion duration from inbound and outbound channels
@ozangunalp ozangunalp merged commit 94a78a5 into smallrye:main Dec 4, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow observing message acknowledgment
3 participants