Skip to content

Commit

Permalink
Merge pull request #17047 from mkouba/issue-17040
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoffier authored May 6, 2021
2 parents 92cd22b + 217082e commit 75536ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
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

0 comments on commit 75536ae

Please sign in to comment.