Change the field from a constant to an injected configuration property:
@ApplicationScoped
public class WebhookEventObserver {
@Inject @ConfigurationValue("webhookQueue")
private String webhookQueue;
@Inject
private WebhookProcessor processor;
public void onMessage(@Observes MessageEvent event) {
// check queue here
logger.info("Received [{}] message from [{}]", event, webhookQueue);
processor.handleEvent(event);
}
}
You can't do the @Queue(name = WEBHOOK_QUEUE)
with a dynamic queue name, so remove that event qualifier, and add logic to check it.
Don't know what MessageEvent
is, so don't know how to check the queue of the event.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…