【发布时间】:2018-05-17 22:42:31
【问题描述】:
我在使用队列中的消息时使用 DUPS_OK_ACKNOWLEDGE 模式,我需要检测重复项并忽略它们。
.from(Jms.messageDrivenChannelAdapter(activeMQConnectionFactory)
.destination(sourceQueue)
.configureListenerContainer(spec -> {
spec.sessionTransacted(false);
spec.sessionAcknowledgeMode(Session.DUPS_OK_ACKNOWLEDGE);
}))
.transform(orderTransformer)
.handle(orderService, "save")
.get();
我有一个幂等接收器建议。
@Bean
public IdempotentReceiverInterceptor idempotentReceiverInterceptor() {
IdempotentReceiverInterceptor idempotentReceiverInterceptor = new IdempotentReceiverInterceptor(new MetadataStoreSelector(m ->
(String) m.getHeaders().get("JMSMessageId")));
idempotentReceiverInterceptor.setDiscardChannelName("ignoreDuplicates");
idempotentReceiverInterceptor.setThrowExceptionOnRejection(false);
return idempotentReceiverInterceptor;
}
我被两件事困住了
- 如何在 Jms.messageDrivenChannelAdapter?
- 如果我需要将元数据存储在 oracle/mysql 中,该表与任何示例链接的外观如何
【问题讨论】:
标签: spring-integration spring-integration-dsl