You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by igrahami <ia...@f2s.com> on 2011/06/06 11:24:10 UTC

Limiting the size of a queue

Hi,

ultimately what I am trying to do seems quite simple. I am wanting to use a
queue to decouple the front and backend of our system by putting a jms queue
in between. The information being put on the queue isn't 100% important, it
is more important that what is going on in the frontend is not blocked by
the backend processing.

I have setup an in vm memory local not persistent queue with all async
options set but limiting by number of messages doesn't seem possible (after
lots of searching) so have managed to setup a limit by memory size in a
policy map. 

I have all the setting setup in spring, section of important bit of config
below:

<amq:broker useJmx="true" persistent="false">

        <amq:destinationPolicy>
            <amq:policyMap>
                <amq:policyEntries>
                    <amq:policyEntry queue="auditLogQueue"
memoryLimit="10mb"/>
                </amq:policyEntries>
            </amq:policyMap>
        </amq:destinationPolicy>
        <amq:transportConnectors>
            <amq:transportConnector uri="tcp://localhost:0"/>
        </amq:transportConnectors>
    </amq:broker>

    <amq:queue id="auditLogQueue"
physicalName="sky.oogway.audit.log.queue"/>

    <amq:connectionFactory id="amqConnectionFactory"
brokerURL="vm://localhost" sendTimeout="100" useAsyncSend="true"
alwaysSyncSend="false" alwaysSessionAsync="true" dispatchAsync="true"
sendAcksAsync="true" />

Problem is the message producers keep blocking until they get the message
onto the queue, I just want the producer to try and if not possible straight
away then just throw exception (which I will catch and log) and carry on
with frontend work. From much searching this does seem possible but nothing
I try seems to work. I have got round the problem for now by putting the
sendTimeout="100" on the connection factory but ultimately I don't want to
have to have that setting.

Help much appreciated,
cheers,
Ian

--
View this message in context: http://activemq.2283324.n4.nabble.com/Limiting-the-size-of-a-queue-tp3576502p3576502.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Limiting the size of a queue

Posted by igrahami <ia...@f2s.com>.
Hi,

yes thanks for the reply, that was what I had been playing around with to
try and get it to work.

I just came across this blog:
http://blog.garytully.com/2009/01/activemq-systemusage-xml-configuration.html

and that has sorted it for me. I had systemUsage within a
producerSystemUsage block but that wasn't working, the below does.

I now have:
        <amq:systemUsage>
             <amq:systemUsage sendFailIfNoSpace="true">
               <amq:memoryUsage>
                 <amq:memoryUsage limit="10mb" />
               </amq:memoryUsage>
             </amq:systemUsage>
        </amq:systemUsage>

within the broker definition and it all seems to work.

cheers.

--
View this message in context: http://activemq.2283324.n4.nabble.com/Limiting-the-size-of-a-queue-tp3576502p3582321.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Limiting the size of a queue

Posted by Torsten Mielke <to...@fusesource.com>.
Have a look at sendFailIfNoSpace property as part of configuring
ProducerFlowControl.
http://activemq.apache.org/producer-flow-control.html