@Target(value=METHOD) @Retention(value=RUNTIME) public @interface ConsumeEvent
The method must accept exactly one parameter. If it accepts Message
then the return type must
be void. For any other
type the Message.body()
is passed as the parameter value and the method may return an object that is passed to
Message.reply(Object)
, either
directly or via
CompletionStage.thenAccept(java.util.function.Consumer)
in case of the method returns a
completion stage.
@ApplicationScoped class MyService { @ConsumeEvent("echo") String echo(String msg) { return msg.toUpperCase(); } @ConsumeEvent("echoMessage") void echoMessage(Messagemsg) { msg.reply(msg.body().toUpperCase()); } @ConsumeEvent(value = "echoMessageBlocking", blocking = true) void echoMessageBlocking(Message msg) { msg.reply(msg.body().toUpperCase()); } }
EventBus
Modifier and Type | Fields and Description |
---|---|
static int |
FAILURE_CODE
Failure code used when a message consumer method throws an exception.
|
public static final int FAILURE_CODE
public abstract String value
Copyright © 2019 JBoss by Red Hat. All rights reserved.