qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lizzrd <tim_ri...@cpr.ca>
Subject Re: SpringBoot 2.1.3 Qpid client(6.3.3) high cpu when broker shutdown
Date Fri, 08 Mar 2019 16:49:35 GMT
Oleksandr,

I am using qpidd (qpid-cpp) version 1.35.0 which is docker
fedora/qpid:latest.
The setup to produce the behavior is fairly simple.

import org.apache.qpid.client.AMQConnectionFactory;
import org.apache.qpid.url.URLSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.listener.adapter.MessageListenerAdapter;
import org.springframework.util.ErrorHandler;

@Configuration
public class AmqpConfig
{
    private static Logger logger =
LoggerFactory.getLogger(AmqpConfig.class);

    @Bean
    AMQConnectionFactory connectionFactory() throws URLSyntaxException {
        AMQConnectionFactory connectionfactory = new AMQConnectionFactory();
       
connectionfactory.setConnectionURLString("amqp://guest:guest@127.0.0.1:5672/?brokerlist='tcp://127.0.0.1:5672'");
        return connectionfactory;
    }

    @Bean
    DefaultMessageListenerContainer container() throws URLSyntaxException {
        final DefaultMessageListenerContainer container = new
DefaultMessageListenerContainer();
        container.setAutoStartup(true);
        container.setConnectionFactory(connectionFactory());
        container.setDestinationName("QueueName");
        container.setConcurrentConsumers(5);
        container.setErrorHandler(jmsErrorHandler());
        return container;
    }

    @Bean
    public void readit() {
        try {
            container().setupMessageListener(new MessageListenerAdapter() {
                public void handleMessage(byte[] byteArray) {
                    logger.info("Plain Handler");
                }
            });
        } catch (URLSyntaxException e) {
            e.printStackTrace();
        }
    }

    @Bean
    ErrorHandler jmsErrorHandler(){
        ErrorHandler jmsErrorHandler = new JmsErrorHandler();
        return jmsErrorHandler;
    }
}

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ErrorHandler;

public class JmsErrorHandler implements ErrorHandler {
    private static Logger log =
LoggerFactory.getLogger(JmsErrorHandler.class);

    public void handleError(final Throwable e) {
        log.info("  Exception == " + e.getMessage());
        e.printStackTrace();
    }
}



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message