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

Vertx ConsumeEvent - document failure handling #17047

Merged
merged 1 commit into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/src/main/asciidoc/reactive-event-bus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ public void consume(Message<String> msg) {
}
----

=== Handling Failures

If a method annotated with `@ConsumeEvent` throws an exception then:

* if a reply handler is set then the failure is propagated back to the sender via an `io.vertx.core.eventbus.ReplyException` with code `ConsumeEvent#FAILURE_CODE` and the exception message,
* if no reply handler is set then the exception is rethrown (and wrapped in a `RuntimeException` if necessary) and can be handled by the default exception handler, i.e. `io.vertx.core.Vertx#exceptionHandler()`.

== Sending messages

Ok, we have seen how to receive messages, let's now switch to the _other side_: the sender.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@
* </pre>
*
* <p>
* The CDI request context is active during notification of the registered message consumer.
* The CDI request context is always active during notification of the registered message consumer.
* <p>
* If a method annotated with {@link ConsumeEvent} throws an exception then:
* <ul>
* <li>if a reply handler is set the failure is propagated back to the sender via an
* {@link io.vertx.core.eventbus.ReplyException} with code {@link #FAILURE_CODE} and the exception message,</li>
* <li>if no reply handler is set then the exception is rethrown (and wrapped in a {@link java.lang.RuntimeException} if
* necessary) and can be handled by the default exception handler, i.e. {@link io.vertx.core.Vertx#exceptionHandler().}</li>
* </ul>
*
* @see io.vertx.core.eventbus.EventBus
*/
@Target({ METHOD })
@Target(METHOD)
@Retention(RUNTIME)
public @interface ConsumeEvent {

Expand Down