JMS JMSTemplate 3.0.1RELEASE를 사용하여 JMS 메시지를 ActiveMQ 클러스터로 보냅니다.Spring JMSTemplate - 메시지 손실
비동기 요청을 보낼 수 있으려면 useAsynSend = true를 사용합니다. 모두 비상용 및 비회용입니다. 그러나 그들은 여전히 끈질 기고, 나는 그들이 AMQ Kaha-DB에서 영속성을 유지하고 메시지 청취자에게 전달된다는 것을 확인할 수 있습니다. CorelationID 또는 JMSReplyTo가 없으므로 응답을 수신 대기하지 않습니다. ActiveMQProductBinding 클래스에서
<amq:connectionFactory id="amqJmsFactory"
brokerURL="failover:(tcp://MY-SERVER-01:61616,tcp://MY-SERVER-02:61616)?randomize=true&jms.useAsyncSend=true" />
<!-- JMS Producer Configuration -->
<bean id="jmsProducerTemplate" class="org.springframework.jms.core.JmsTemplate"
p:connectionFactory-ref="amqJmsFactory" />
<bean id="activeMQBinding" class="com.my.company.activemq.ActiveMQProductBinding">
<property name="template" ref="jmsProducerTemplate" />
</bean>
우리는 이제 로그 인쇄지고 로그에서 볼 수있는 다음과 같은 방법을
public void sendActiveMQMessageAsync(final Object message, String qName) {
log.info("About to send message");
template.send(qName, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
ObjectMessage objectMessage = session.createObjectMessage((Serializable) message);
log.info("Sending message: " + objectMessage);
return objectMessage;
}
});
}
있습니다. 예외는 발생하지 않습니다. 아직도 몇몇 메시지는 완전히 길을 잃고있다. 아마 ActiveMQ에 도달하지 않습니다. 위의 'qName'에 의해 정의 된 ActiveMQ 대기열의 메시지를 수신 대기하도록 구성된 Mule JMS Listener가 있습니다. 대부분의 메시지는 AMQ에 전달되고 Mule은 몇 초 이내에 메시지를 가져옵니다. 그러나 그것은 잃어 가고있는 일부 메시지 일뿐입니다. ActiveMQ에서 대기열을 검사했을 때 수신 된 모든 메시지가 Mule에 정상적으로 발송 된 것을 볼 수 있습니다. 따라서 메시지가 ActiveMQ에 전혀 도달하지 못하거나 AMQ가 거부하고있는 것으로 의심됩니다. 그러나 JMSTemplate 스프링 또는 ActiveMQ에 대한 로그가 없습니다.
작성된 메시지는 다음과 같습니다 (위의 방법으로 인쇄됩니다).
2013-03-11 16:33:11,752 INFO [com.my.company.activemq.ActiveMQProductBinding$1] Sending message: ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = [email protected], marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false}
AMT에서 JMSTemplate 구성 또는 일부 동작에 누락 된 사항이 있습니까? 도와주세요!
도움 사람이 있습니까?
누락 된 메시지는 다른 브로커에 있으며 소비되지 않는 것 같습니다. – techuser
안녕하세요 .. 미안하지만 좀 더 정교하게 설명해 주실 수 있습니까? – Soumya
제 제안은 장애 조치 연결을 사용하는 임의의 브로커에서 메시지 수를 확인하고 소비자가 실제로 브로커에서 소비하는지 확인하는 것입니다. – techuser