有些消息在activemq + spring boot

时间:2017-01-12 15:30:16

标签: spring-boot activemq

对于我的应用程序(Spring启动+ ActiveMq),如果我在应用程序中消耗jms消息,当它涉及到该应用程序的另一个应用程序时它只消耗一次它消耗7次,当查看日志表明redelivercount增加了一个一次,最多7次。

这是配置问题还是其他问题?

2017年1月12日20:34:14,473 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 0 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:15,624 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 1 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:16,667 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 2 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:17,725 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 3 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:18,884 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 4 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:19,934 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 5 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

2017年1月12日20:34:20,976 [7553] [DefaultMessageListenerContainer-1] INFO com.xerago.rsa.jms.Consumer 21 {} - ActiveMQMapMessage ::: ActiveMQMapMessage {commandId = 5,responseRequired = true,messageId = ID :DWTECH031-44805-1484233018540-1:2:1:1:1,originalDestination = null,originalTransactionId = null,producerId = ID:DWTECH031-44805-1484233018540-1:2:1:1,destination = queue:// soapCall ,transactionId = null,expiration = 0,timestamp = 1484233454452,arrival = 0,brokerInTime = 1484233454452,brokerOutTime = 1484233454453,correlationId = Hai,replyTo = null,persistent = true,type = null,priority = 4,groupID = null,groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,content = org.apache.activemq.util.ByteSequence@6ef648b,marshalledProperties = null,dataStructure = null, redeliveryCounter = 6 ,size = 0,properties = null,readOnlyProperties = true,readOnlyBody = true,droppable = false,jmsXGroupFirstForConsumer = false} ActiveM QMapMessage {theTable = {QuoteId = FHM166963}}

@Component
public class Consumer {

    @JmsListener(destination = "soapCall")
    public String receiveQueue(ActiveMQMapMessage activeMQMapMessage) throws Exception {
        try {
            LOGGER.info("ActiveMQMapMessage ::: " + activeMQMapMessage);
            LOGGER.info("activeMQMapMessage.getJMSCorrelationID() :: " + activeMQMapMessage.getJMSCorrelationID());
            LOGGER.info("activeMQMapMessage.getContentMap() :: " + activeMQMapMessage.getContentMap());
            String Id = activeMQMapMessage.getString("Id");
            return Id;  
        } catch (Exception e) {
            LOGGER.info(e.getMessage(), e);
            throw e;
        }
    }
}

Producer.java

@Component
public class MakeEcall {

    private static final Logger LOGGER = LogManager.getRootLogger();

    @Autowired
    JmsTemplate jmsTemplate;

    public void send(ActiveMQMapMessage activeMQMapMessage) throws Exception {
        this.jmsTemplate.convertAndSend("soapCall", activeMQMapMessage );
        LOGGER.info("Call triggered Successfully.... Posted into JMSQueue for this " + activeMQMapMessage.getString("Id"));
    }
}

1 个答案:

答案 0 :(得分:0)

如文档中所述

  

带注释的方法可能具有非void返回类型。当它们这样做时,方法调用的结果作为JMS回复发送到由传入消息的JMSReplyTO头定义的目标。

正如我在你的日志中看到的replyTo = null所以你的问题是返回类型不是无效。