我正在使用 Spring Integration 2。我有以下场景。由正文字段和收件人列表组成的“MassMessageObject”。我正在实现一个拆分器来为列表中的每个收件人创建一个“BasicMessageObject”。问题是分离器的输出通道只接收到第一条消息。例如:
MassMessageObject> [body: Hello, recipients{A,B}] 正在创建 BasicMessageObject {[body: Hello, recipient: A], [body: Hello, recipient: B]} 的列表。
连接到输出通道的端点正在接收“[body: Hello, recipient: A]”而不是“[body: Hello, recipient: B]”。
以下是我的应用程序上下文:
<int:splitter input-channel="mass_receiving_channel"
output-channel="receiving_channel"
method="splitMessages"
ref="massMessageSplitter"/>
<!-- Main Chain. The one that will lead to the messageTypeRouter -->
<int:chain input-channel="receiving_channel" output-channel="sms_channel">
<int:service-activator ref="saveMessageToDB" method="saveMessageToDB"/>
<int:gateway request-channel="message_type_router_channel"/>
</int:chain>
以下是分线器...
public List<BasicMessageObject> splitMessages(final GenericMessage message) {
List<BasicMessageObject> messages = new ArrayList<BasicMessageObject>();
// DOING STUFF HERE
return messages;
}
}
[springframework.integration.jms.ChannelPublishingJmsMessageListener:234] - converted JMS Message [ActiveMQObjectMessage {commandId = 6, responseRequired = true, messageId = ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1, originalDestination = null, originalTransactionId = null, producerId = ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2, destination = queue://mass_messaging_queue, transactionId = null, expiration = 0, timestamp = 1335249128840, arrival = 0, brokerInTime = 1335249128841, brokerOutTime = 1335249128842, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@39673d71, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false}] to integration Message payload [com.connexo.icubeplus3.dispatcher.connector.messageobjects.SmsMassMessageObject@28f2e328]
[springframework.integration.channel.DirectChannel:224] - preSend on channel 'mass_receiving_channel', message: [Payload=com.connexo.icubeplus3.dispatcher.connector.messageobjects.SmsMassMessageObject@28f2e328][Headers={timestamp=1335249128882, id=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}]
[springframework.integration.splitter.MethodInvokingSplitter:72] - org.springframework.integration.splitter.MethodInvokingSplitter@56de9984 received message: [Payload=com.connexo.icubeplus3.dispatcher.connector.messageobjects.SmsMassMessageObject@28f2e328][Headers={timestamp=1335249128882, id=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}]
[springframework.integration.splitter.MethodInvokingSplitter:157] - handler 'org.springframework.integration.splitter.MethodInvokingSplitter@56de9984' sending reply Message: [Payload=[SMS] [sender: icube+] [destination: +35611111111] [messageIdentifier: 1234] [clientId: 1]][Headers={timestamp=1335249137537, id=566d7d54-f4cc-4896-8d39-d95636c20a57, correlationId=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, sequenceSize=4, sequenceNumber=1, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}]
[springframework.integration.channel.DirectChannel:224] - preSend on channel 'receiving_channel', message: [Payload=[SMS] [sender: icube+] [destination: +35611111111] [messageIdentifier: 1234] clientId: 1]][Headers={timestamp=1335249137537, id=566d7d54-f4cc-4896-8d39-d95636c20a57, correlationId=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, sequenceSize=4, sequenceNumber=1, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}]
[springframework.integration.handler.MessageHandlerChain:72] - org.springframework.integration.handler.MessageHandlerChain#0 received message: [Payload=[SMS] [sender: icube+] [destination: +35611111111] [messageIdentifier: 1234] [clientId: 1]][Headers={timestamp=1335249137537, id=566d7d54-f4cc-4896-8d39-d95636c20a57, correlationId=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, sequenceSize=4, sequenceNumber=1, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}]
[springframework.integration.handler.ServiceActivatingHandler:72] - ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor@27b71c12] received message: [Payload=[SMS] [sender: icube+] [destination: +35611111111] [messageIdentifier: 1234] [clientId: 1]][Headers={timestamp=1335249137537, id=566d7d54-f4cc-4896-8d39-d95636c20a57, correlationId=fb9904da-f5b1-49e0-af25-6711015f1365, jms_redelivered=false, sequenceSize=4, sequenceNumber=1, jms_messageId=ID:PC-CMICALLEF-61953-1335249128607-0:0:1:2:1}] ....