You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "asliyanage@gmail.com" <as...@gmail.com> on 2017/08/20 03:14:41 UTC
How to stop retry continously
I have develop small activemq message application using ProducerTemplate .
Its working fine.But when the ActiveMQ server is not available it keep
trying to send message to queue . So i need to find a way to stop keep
trying this.I try to add timeout in connection factory as below. but still
not working
<bean primary="true" id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory" >
<property name="brokerURL"
value="failover:(tcp://localhost:61616)"/>
<property name="useAsyncSend" value="true"/>
<property name="Topic" value="false"/>
*<property name="closeTimeout" value="5000"/>*
</bean>
--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-stop-retry-continously-tp4729842.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to stop retry continously
Posted by "asliyanage@gmail.com" <as...@gmail.com>.
how can i addd the sendTimeout setting. the example you given dones't have
proper details. can you please tell me how to add sendTimeout to my
project?
--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-stop-retry-continously-tp4729842p4729853.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to stop retry continously
Posted by Tim Bain <tb...@alumni.duke.edu>.
OK, so if your goal is simply to allow the producer to detect that the
broker is unavailable, you can get the behavior you want by using the
sendTimeout setting (
https://stackoverflow.com/questions/15315631/activemqconnectionfactory-sendtimeout)
instead of the closeTimeout setting (whose purpose is to prevent closing
the connection - which you're not doing - from waiting forever).
Tim
On Aug 20, 2017 7:13 PM, "asliyanage@gmail.com" <as...@gmail.com>
wrote:
> i need to handle the exception when the broker is not available. Currently
> if
> broker is down my produser always try to send message to queue and it
> doesn't stop the trying send the message
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/How-to-stop-retry-continously-tp4729842p4729851.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Re: How to stop retry continously
Posted by "asliyanage@gmail.com" <as...@gmail.com>.
i need to handle the exception when the broker is not available. Currently if
broker is down my produser always try to send message to queue and it
doesn't stop the trying send the message
--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-stop-retry-continously-tp4729842p4729851.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to stop retry continously
Posted by Tim Bain <tb...@alumni.duke.edu>.
If you don't want to try to reconnect, you could use the static transport
in place of the failover transport. That would mean that any inability to
connect to the broker (either at initial connection time or due to a
connectivity loss later on) would result in the producer being permanently
disconnected with no automatic reconnect attempts made. But I can't think
why you'd want to do that.
Tim
On Aug 20, 2017 11:27 AM, "asliyanage@gmail.com" <as...@gmail.com>
wrote:
> I have develop small activemq message application using ProducerTemplate .
> Its working fine.But when the ActiveMQ server is not available it keep
> trying to send message to queue . So i need to find a way to stop keep
> trying this.I try to add timeout in connection factory as below. but still
> not working
>
> <bean primary="true" id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory" >
> <property name="brokerURL"
> value="failover:(tcp://localhost:61616)"/>
> <property name="useAsyncSend" value="true"/>
> <property name="Topic" value="false"/>
> *<property name="closeTimeout" value="5000"/>*
> </bean>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/How-to-stop-retry-continously-tp4729842.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>