你的问题在这里:
Amqp.inboundGateway(getListenerContainer(queue, concurrentConsumers, prefetchCount)
同时,您的下游流程是单向的,不返回任何回复:
.handle(p -> {
UpdateSecretEvent payload = (UpdateSecretEvent) p.getPayload();
System.out.println("Account: " + payload.getAccountId() + " has secret: " + payload.getNewSecret());
})
.get();
或者
.handle(p -> {
UpdateEmailEvent payload = (UpdateEmailEvent) p.getPayload();
System.out.println("Account: " + payload.getAccountId() + " has email: " + payload.getEmail());
})
.get();
所以,那AmqpInboundGateway
等待它的MessagingTemplate.sendAndReceive()
回复private static final long DEFAULT_TIMEOUT = 1000L;
切换到Amqp.inboundAdapter()
那里可以解决问题。