【发布时间】:2020-05-12 20:55:44
【问题描述】:
我有一个带有声明的 AMQP 源和 AMQP 接收器:
List<Declaration> declarations = new ArrayList<Declaration>() {{
add(QueueDeclaration.create(sourceExchangeName));
add(BindingDeclaration.create(sourceExchangeName, sourceExchangeName).withRoutingKey(sourceRoutingKey));
}};
amqpSource = AmqpSource
.committableSource(
NamedQueueSourceSettings.create(connectionProvider, sourceExchangeName)
.withDeclarations(declarations),
bufferSize);
AmqpWriteSettings amqpWriteSettings = AmqpWriteSettings.create(connectionProvider)
.withExchange("DEST_XCHANGE")
.withRoutingKey("ROUTE123")
.withDeclaration(ExchangeDeclaration.create(destinationExchangeName,
BuiltinExchangeType.DIRECT.getType()));
amqpSink = AmqpSink.create(amqpWriteSettings);
然后我有一个流程..
amqpSource.map(doSomething).async().map(doSomethingElse).async().to(amqpSink)
现在,在我启动应用程序后,发送到源队列的消息没有被消耗。后来我发现这是由于声明期间发生的错误。 (即,当我在 Source 和 Sink 设置中删除 .withDeclarations(..) 时,它运行良好。
所以我的问题:
- 如何检测 AMQP Source 和 Sink 是否正常运行?
- 如何忽略声明异常?
- 如果出现异常,如何知道并导致系统出现故障?
【问题讨论】:
标签: akka akka-stream akka-http akka-cluster alpakka