You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "gajanan.samaji" <ga...@gmail.com> on 2019/06/14 19:21:03 UTC

Messages in pending state - session-transacted, concurrency, cacheconsumers

I have implemented apache activemq on hybris environment that uses tomcat
server. I am deploying both producer and consumer on same host with jms
installed on one of the application servers. All clustered app servers use
the same jms broker url and create their own queues on JMS. This was working
fine in all lower environments but once moved to production we see a lot of
pending messages. Which are not redelivered. I have no no idea why they are
going to pending state. Any help please?

Follwing is the configuration object:

@Bean
public ActiveMQConnectionFactory connectionFactory()
{
    final ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory();
    final RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
   
redeliveryPolicy.setInitialRedeliveryDelay(TimeUnit.MINUTES.toMillis(Long.parseLong(initialRedeliveryDelay)));
   
redeliveryPolicy.setRedeliveryDelay(TimeUnit.HOURS.toMillis(Long.parseLong(redeliveryDelay)));
    redeliveryPolicy.setUseExponentialBackOff(false);
   
redeliveryPolicy.setMaximumRedeliveries(Integer.parseInt(maximumRedeliveries));

    connectionFactory.setRedeliveryPolicy(redeliveryPolicy);
   
connectionFactory.setTrustedPackages(Arrays.asList("com.cintas.core.jms",
"javax.mail.internet", "java.util",
            "de.hybris.platform.acceleratorservices.model.email",
"de.hybris.platform.servicelayer.model.strategies",
            "com.cintas.integration.vo.email"));
    connectionFactory.setBrokerURL(brokerUrl);
    connectionFactory.setUserName(userName);
    connectionFactory.setPassword(password);
    return connectionFactory;
}

@Bean
public ConnectionFactory cachingConnectionFactory()
{
    final CachingConnectionFactory connectionFactory = new
CachingConnectionFactory();
    connectionFactory.setTargetConnectionFactory(connectionFactory());
    connectionFactory.setCacheConsumers(false);
    return connectionFactory;
}

@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(final
JMSErrorHandler errorHandler)
{
    final DefaultJmsListenerContainerFactory factory = new
DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory());
    factory.setSessionTransacted(true);
    factory.setConcurrency(concurrency);
    factory.setErrorHandler(errorHandler);

    return factory;
}



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-f2368404.html