0

In application.properties I set the address name of the EventBus, as follows:

event-bus.channel = persist

In my consumer class, I defined the method consuming the message, with ConsumeEvent annotation:

@ApplicationScoped
@Slf4j
public class MyConsumer {
    @ConsumeEvent("{event-bus.channel}")
    public void consumeMessage(String message){
        log.debug("Received a message: " + message);
    }
}

The address is not set as "persist", because the consumer does not receive any message from the producer.

If I change the annotation as

@ConsumeEvent("persist")

the consumer can receive messages.

I also tried change the annotation as

@ConsumeEvent(ConfigProvider.getConfig().getValue("event-bus.channel", String.class))

but it does not work, because the parameter must be a constant.

How can I set the address in the annotation with a property defined in application.properties?

A M
  • 831
  • 1
  • 14
  • 26
  • 1
    @ConsumerEvent addresses cannot come from the configuration. They must be defined explicitly. Can you open an issue about it? This is something we can add. – Clement Jun 27 '23 at 14:37

0 Answers0