You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by eric wen <we...@hotmail.com> on 2011/12/26 12:06:46 UTC
how can i config to let amq remove the queue message when timeout
hi,
i have a program which receive client request and then transfer the
message via amq to a processor which watches on the specified queue.
However, the processor may not start up while the cilent request arrives,
then amq will then store this message temporarily, and after the processor
start up, amq will send this store message to the processor.
what i'm wondering is, how can i let amq to remove this temporary
message after some time the processor is not available or let amq do not
send this 'timeout' temporary message to the processor when is started.
i had tried to set the sendTimeout property on the ConnectionFactory
which looks like this:
<spring:bean id="activeMqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://localhost:61616" />
<spring:property name="userName" value="system" />
<spring:property name="password" value="manager" />
<spring:property name="sendTimeout" value="30000" />
</spring:bean>
but it seems doesn't work,wish your reply
eric wen
--
View this message in context: http://activemq.2283324.n4.nabble.com/how-can-i-config-to-let-amq-remove-the-queue-message-when-timeout-tp4234322p4234322.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how can i config to let amq remove the queue message when timeout
Posted by Stevo Slavić <ss...@gmail.com>.
There is related ActiveMQ FAQ entry:
http://activemq.apache.org/how-do-i-set-the-message-expiration.html
Regards,
Stevo.
On Mon, Dec 26, 2011 at 12:30 PM, Stevo Slavić <ss...@gmail.com> wrote:
> Since you're using Spring, and using JmsTemplate to send messages, make
> use of "void org.springframework.jms.core.JmsTemplate.send(Destination
> destination, MessageCreator messageCreator) throws JmsException" and
> implement MessageCreator which will set JMSExpiration
>
> sendTimeout and receiveTimeout have nothing to do with Message
> JMSExpiration
>
> Regards,
> Stevo.
>
>
> On Mon, Dec 26, 2011 at 12:06 PM, eric wen <we...@hotmail.com> wrote:
>
>> hi,
>> i have a program which receive client request and then transfer the
>> message via amq to a processor which watches on the specified queue.
>> However, the processor may not start up while the cilent request arrives,
>> then amq will then store this message temporarily, and after the processor
>> start up, amq will send this store message to the processor.
>>
>> what i'm wondering is, how can i let amq to remove this temporary
>> message after some time the processor is not available or let amq do not
>> send this 'timeout' temporary message to the processor when is started.
>>
>> i had tried to set the sendTimeout property on the ConnectionFactory
>> which looks like this:
>>
>> <spring:bean id="activeMqConnectionFactory"
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>> <spring:property name="brokerURL" value="tcp://localhost:61616" />
>> <spring:property name="userName" value="system" />
>> <spring:property name="password" value="manager" />
>> <spring:property name="sendTimeout" value="30000" />
>> </spring:bean>
>>
>> but it seems doesn't work,wish your reply
>>
>> eric wen
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/how-can-i-config-to-let-amq-remove-the-queue-message-when-timeout-tp4234322p4234322.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>
RE: how can i config to let amq remove the queue message when
timeout
Posted by eric wen <we...@hotmail.com>.
hello, Stevo
thank you very much for your prompt reply.
you have enlightened me and finally i finished my work as what i want. thanks again.
i'm using jms(amq5.5) with mule 3.1.2, what i want is to remove expired messages stored in amq automatically, and now my mule configuration file looks like this:
<mule ...>
<jms:activemq-connector name="jmsConnector"
acknowledgementMode="AUTO_ACKNOWLEDGE"
specification="1.1"
persistentDelivery="false"
cacheJmsSessions="true"
connectionFactory-ref="activeMqConnectionFactory" />
<spring:bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://localhost:61616" />
<spring:property name="userName" value="system" />
<spring:property name="password" value="manager" />
<spring:property name="sendTimeout" value="30000" />
</spring:bean>
<flow name="esbEntrance">
<http:inbound-endpoint address="http://localhost:19090/esb/services" exchange-pattern="request-response">
<byte-array-to-string-transformer encoding="UTF-8" />
</http:inbound-endpoint>
<jms:outbound-endpoint queue="#[xpath:/flow/@id]" exchange-pattern="request-response" responseTimeout="60000" connector-ref="jmsConnector">
<message-properties-transformer scope="outbound">
<!-- tell amq to expire this message after some time. -->
<add-message-property key="JMSExpiration" value="30000" />
<add-message-property key="timeToLive" value="30000"/>
</message-properties-transformer>
</jms:outbound-endpoint>
</flow>
</mule>
i've tested this, it seems, actually amq will remove this expired message when responseTimeout after 60 seconds yet not timeToLive which is 30 seconds
but it doesn't matter, i'll study about this further.
Regards,
Eric.
--
View this message in context: http://activemq.2283324.n4.nabble.com/how-can-i-config-to-let-amq-remove-the-queue-message-when-timeout-tp4234322p4238821.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how can i config to let amq remove the queue message when timeout
Posted by Stevo Slavić <ss...@gmail.com>.
Since you're using Spring, and using JmsTemplate to send messages, make use
of "void org.springframework.jms.core.JmsTemplate.send(Destination
destination, MessageCreator messageCreator) throws JmsException" and
implement MessageCreator which will set JMSExpiration
sendTimeout and receiveTimeout have nothing to do with Message JMSExpiration
Regards,
Stevo.
On Mon, Dec 26, 2011 at 12:06 PM, eric wen <we...@hotmail.com> wrote:
> hi,
> i have a program which receive client request and then transfer the
> message via amq to a processor which watches on the specified queue.
> However, the processor may not start up while the cilent request arrives,
> then amq will then store this message temporarily, and after the processor
> start up, amq will send this store message to the processor.
>
> what i'm wondering is, how can i let amq to remove this temporary
> message after some time the processor is not available or let amq do not
> send this 'timeout' temporary message to the processor when is started.
>
> i had tried to set the sendTimeout property on the ConnectionFactory
> which looks like this:
>
> <spring:bean id="activeMqConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <spring:property name="brokerURL" value="tcp://localhost:61616" />
> <spring:property name="userName" value="system" />
> <spring:property name="password" value="manager" />
> <spring:property name="sendTimeout" value="30000" />
> </spring:bean>
>
> but it seems doesn't work,wish your reply
>
> eric wen
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/how-can-i-config-to-let-amq-remove-the-queue-message-when-timeout-tp4234322p4234322.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>