我正在使用SpringIntegration的IntegrationFlows定义消息流,并使用Jms.messageDrivenChannelAdapter从MQ获取消息,现在我需要解析它,将其发送到KAFKA并更新Couchbase。
IntegrationFlows
.from(Jms.messageDrivenChannelAdapter(this.acarsMqListener)) //MQ Listener with session transacted=true
.wireTap(ACARS_WIRE_TAP_CHNL) // Logging the message
.transform(agmTransformer, "parseXMLMessage") // Parse the xml message
.filter(acarsFilter,"filterMessageOnSmi") // Filter the message based on condition
.transform(agmTransformer, "populateImi") // Parse and Populate based on the message payload
.filter(acarsFilter,"filterMessageOnSmiImi") // Filter the message based on condition
.handle(acarsProcessor, "processEvent") // Create the message
.handle(Kafka.outboundChannelAdapter(kafkaTemplate).messageKey(MESSAGE_KEY).topic(acarsKafkaTopic)) //send it to kafka
.handle(updateCouchbase, "saveToDB") // Update couchbase
.get();
根据应用程序逻辑-消息应存储在kafka和benchbase中,如果将消息存储到kafka和bedfbase中有任何异常,则应将消息回滚到队列中。上面的消息流是否符合预期的行为?您能否建议是否可以做任何改善?