activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Erickson <>
Subject Message Head of line blocking
Date Sat, 07 Nov 2009 18:35:53 GMT

Hi All,
I am using AMQ inside a Spring IoC container.  It is a very simple setup
with the following config:

  <!--  ActiveMQ Broker -->
  <amq:broker useJmx="false" persistent="false">
      <amq:transportConnector uri="tcp://localhost:0" />

   <!--  ActiveMQ destinations to use  -->
  <amq:queue id="mailDestination"  physicalName="mailsender"/>

  <!-- JMS ConnectionFactory to use, configuring the embedded broker using
XML -->
  <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost">
      <amq:redeliveryPolicy backOffMultiplier="2"
useExponentialBackOff="true" initialRedeliveryDelay="1000"
  <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
      <!-- lets wrap in a pool to avoid creating a connection per send -->
      <bean class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="connectionFactory">
          <ref local="jmsFactory"/>
    <property name="pubSubDomain">

  <bean id="mailContainer"
      <property name="connectionFactory" ref="jmsFactory"/>
      <property name="destination" ref="mailDestination"/>
      <property name="messageListener" ref="mailConsumer"/>
      <property name="sessionTransacted" value="true"/>

Along with one corresponding producer and consumer.

My question is this, I noticed that my consumer was having problems sending
one of the emails in the queue, it was throwing an exception, being placed
back in the queue, then the entire queue was waiting the backoff time for
this message to attempt to be delivered again, over and over again,
producing a head of line blocking problem (no messages can be delivered
until the one with the error is delivered).

Is there a solution for this? Can the message that failed be pushed to a
re-delivery queue, or a troubled queue rather than the main queue? Or can
the consumer walk through the queue looking for a message that is ready to
be delivered rather than blocking on the front message that isn't set to be
delivered for some long amount of time because of a previous failure and
backoff time?

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message