activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svein Liu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4036) consumer can't receive message
Date Tue, 11 Sep 2012 11:52:08 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452951#comment-13452951
] 

Svein Liu commented on AMQ-4036:
--------------------------------

public void testServer() {
        String url = "tcp://172.16.27.238:61616";
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
        RedeliveryPolicy redeliveryPolicy = connectionFactory.getRedeliveryPolicy();
        redeliveryPolicy.setMaximumRedeliveries(2);
        redeliveryPolicy.setInitialRedeliveryDelay(2);
        redeliveryPolicy.setUseExponentialBackOff(true);
        redeliveryPolicy.setBackOffMultiplier((short) 1);
        
        Connection connection = null;
        try {
            connection = connectionFactory.createConnection();
            connection.start();
            final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Destination queue = session.createQueue("IA_PROCESS_REQUEST");
            MessageConsumer consumer = session.createConsumer(queue);
            consumer.setMessageListener(new MessageListener() {

                public void onMessage(Message message) {
                    try {
                        LOG.info("receive message:" + message.toString());
                        if (message instanceof MapMessage) {
                            MapMessage map = (MapMessage) message;
                            Long id = map.getLong("id");
                            LOG.info("----id=" + id);
                            String content = map.getString("content");
                            LOG.info("----content=" + content);
                        }else {
                            LOG.info("message is not MapMessage! msg=" + message.getClass().getName());
                        }
                         message.acknowledge();
                    } catch (JMSException e) {
                        try {
                            session.recover();
                        } catch (JMSException e1) {
                        }
                    } catch (RuntimeException e2) {
                        try {
                            session.recover();
                        } catch (JMSException e1) {
                        }
                    }
                }
            });
        } catch (JMSException e) {
            e.printStackTrace(); 
        }

    }
                
> consumer can't receive message
> ------------------------------
>
>                 Key: AMQ-4036
>                 URL: https://issues.apache.org/jira/browse/AMQ-4036
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.5.1
>            Reporter: Svein Liu
>
> I create two listeners connect my mq server, but i found they can't receive messages;i
browse the queue list page, the number of pending messages is 185125 , the number of message
enqueued is 183489, the number of consumer is 2;but both of consumers can't receive messages;

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message