You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ssenth <se...@eur.ko.com> on 2010/04/28 11:35:02 UTC

activemq component MaxConnection retry

Hi,
I am using the below route to put the message in an ActiveMQ queue

Bean Declaration	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="connectionFactory">
			<bean class="org.apache.activemq.ActiveMQConnectionFactory"/>
		</property>
	</bean>

Routing
	<route>
		<from uri="customComponent:Partner2"/>
		<to uri="activemq:queue:TargetQueue"/>
	</route>

I did send two messages which reached the TargetQueue in ActiveMQ, but when
I stopped the activemq and send the third message, CAMLE did not time
out/stop instead it continuously tries to reconnect to ActiveMQ. Can any one
let me know how or hing on how to configure the route to stop the CAMEL
context after let's say 3 reconnect attempts and backup the message to a
folder.

Did find maxReconnectAttempts and startupMaxReconnectAttempts in
org.apache.activemq.transport.failover.FailoverTransport , but could not
figure out how to set these properties.


Below is the log4jenties

Time: 2:24:32 PM  Priority: DEBUG  Thread: ActiveMQ Task  NDC: null
Category: org.apache.activemq.transport.failover.FailoverTransport Location:
org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:722)
Message:
Connect fail to: tcp://localhost:61616, reason: java.net.ConnectException:
Connection refused: connect
Throwable:
null

Time: 2:24:32 PM  Priority: DEBUG  Thread: ActiveMQ Task  NDC: null
Category: org.apache.activemq.transport.failover.FailoverTransport Location:
org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:756)
Message:
Waiting 30000 ms before attempting connection. 
Throwable:
null

Time: 2:24:32 PM  Priority: DEBUG  Thread: main  NDC: null Category:
org.apache.activemq.transport.failover.FailoverTransport Location:
org.apache.activemq.transport.failover.FailoverTransport.oneway(FailoverTransport.java:406)
Message:
Waiting for transport to reconnect.
Throwable:
null
-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28386612.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AW: AW: activemq component MaxConnection retry

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If its on startup you can use option testConnectionOnStartup to
indicate if Camel should fail on startup if it cannot get a
connection.

However the other issue is within the bounds of Spring if its build to
keep retrying until its success.
Have you checked spring user forum about this issue?



On Thu, May 13, 2010 at 3:22 PM, ssenth <se...@eur.ko.com> wrote:
>
> Claus
> The options does not work I am using CAMEL 2.2.0 and activemq 5.3.1
>        <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="connectionFactory">
>                        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                                <property name="brokerURL"
> value="tcp://<IP>:61616?jms.maxReconnectAttempts=1"/>
>                        </bean>
>                </property>
>        </bean>
>
> Tried to debug the code and found that a thread for
> org.springframework.jms.listener.DefaultMessageListenerContainer is created
> and DefaultMessageListenerContainer.refreshConnectionUntilSuccessful() is
> invoked. Refresh the underlying Connection, not returning before an attempt
> has been successful.
>
> Can you any one let me know how to set the or restrict the retry to make a
> successfull connection.
> --
> View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28547432.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: AW: AW: activemq component MaxConnection retry

Posted by ssenth <se...@eur.ko.com>.
Claus
The options does not work I am using CAMEL 2.2.0 and activemq 5.3.1
	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="connectionFactory">
			<bean class="org.apache.activemq.ActiveMQConnectionFactory">
				<property name="brokerURL"
value="tcp://<IP>:61616?jms.maxReconnectAttempts=1"/>
			</bean>
		</property>
	</bean>

Tried to debug the code and found that a thread for
org.springframework.jms.listener.DefaultMessageListenerContainer is created
and DefaultMessageListenerContainer.refreshConnectionUntilSuccessful() is
invoked. Refresh the underlying Connection, not returning before an attempt
has been successful. 

Can you any one let me know how to set the or restrict the retry to make a
successfull connection.
-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28547432.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AW: AW: activemq component MaxConnection retry

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Those options was from an unit test which means they work.

Maybe you are using and older version of AMQ which do not have those options.


On Fri, Apr 30, 2010 at 6:43 AM, ssenth <se...@eur.ko.com> wrote:
>
> First of all Thank you for all the responses.
> jms.useAsyncSend=false&jms.maxReconnectAttempts=1 again leads to the invalid
> parameter exception. As far as I know the paratemeter which can be set thru
> ActiveMQConnectionFactory are (few of them are show below). I am dont see
> any parameter which related to maxConnectionRetry . I got the parameter from
> the source.
>
> Parameter from ActiveMQConnectionFactory
> disableTimeStampsByDefault;
> optimizedMessageDispatch = true;
> copyMessageOnSend = true;
> useCompression;
> objectMessageSerializationDefered;
> useAsyncSend;
> optimizeAcknowledge;
> closeTimeout = 15000;
> useRetroactiveConsumer;
> exclusiveConsumer;
> nestedMapAndListEnabled = true;
> alwaysSyncSend;
> watchTopicAdvisories = true;
> producerWindowSize = DEFAULT_PRODUCER_WINDOW_SIZE;
> warnAboutUnstartedConnectionTimeout = 500L;
> sendTimeout =0;
> sendAcksAsync=true;
>
>
>
>
>
> Meise, Christoph wrote:
>>
>> Some additions.
>>
>> Have a look at
>> http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java?view=markup
>> -> createCamelContext(). You can find usages there. For me the following
>> was minimum to configure maxReconnectAttempts:
>>
>> <bean id="activemq"
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>               <property name="brokerURL"
>> value="tcp://localhost:61616?jms.useAsyncSend=false&jms.maxReconnectAttempts=1"/>
>>       </bean>
>>
>> Regards
>> Christoph
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Claus Ibsen [mailto:claus.ibsen@gmail.com]
>> Gesendet: Donnerstag, 29. April 2010 12:52
>> An: users@camel.apache.org
>> Betreff: Re: AW: activemq component MaxConnection retry
>>
>> Hi
>>
>> broker. is for embedding a AMQ broker.
>>
>> What he is doing is connecting to an existing remote AMQ broker.
>> I think there is a connection. prefix as well you can use, but I am not
>> sure
>>
>>                 <property name="brokerURL"
>>  value="tcp://localhost:61616?connection.maxReconnectAttempts=3"/>
>>
>> If not you may have to add a 2nd spring bean for the
>> AMQConnectionFactory and declare the options on it directly.
>> And then refer to this factory bean in the AMQ component.
>>
>> Yes we should have the wiki documentation updated with a working example.
>>
>>
>>
>>
>> On Thu, Apr 29, 2010 at 12:25 PM, ssenth <se...@eur.ko.com> wrote:
>>>
>>> HI Christoph,
>>>
>>> I did the following     <bean id="activemq"
>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>                <property name="brokerURL"
>>> value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
>>>        </bean>
>>>
>>> But still getting the error  as show below
>>>
>>> Message:
>>> Uncategorized exception occured during JMS processing; nested exception
>>> is
>>> javax.jms.JMSException: Could not create Transport. Reason:
>>> java.lang.IllegalArgumentException: Invalid connect parameters:
>>> {broker.maxReconnectAttempts=3}
>>> Throwable:
>>> org.springframework.jms.UncategorizedJmsException: Uncategorized
>>> exception
>>> occured during JMS processing; nested exception is
>>> javax.jms.JMSException:
>>> Could not create Transport. Reason: java.lang.IllegalArgumentException:
>>> Invalid connect parameters: {broker.maxReconnectAttempts=3}
>>>        at
>>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>>        at
>>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>>        at
>>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>>        at
>>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
>>>        at
>>> org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
>>>        at
>>> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
>>>        at
>>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
>>>        at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
>>>        at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
>>>        at
>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
>>>        at
>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
>>>        at
>>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>>>        at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>>        at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>>        at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>>        at
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>>        at
>>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>>        at
>>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
>>>        at
>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>        at
>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>
>>> Can you please let me know if you have an idea.
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28398843.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28408488.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: AW: AW: activemq component MaxConnection retry

Posted by ssenth <se...@eur.ko.com>.
First of all Thank you for all the responses.
jms.useAsyncSend=false&jms.maxReconnectAttempts=1 again leads to the invalid
parameter exception. As far as I know the paratemeter which can be set thru
ActiveMQConnectionFactory are (few of them are show below). I am dont see
any parameter which related to maxConnectionRetry . I got the parameter from
the source. 

Parameter from ActiveMQConnectionFactory
disableTimeStampsByDefault;
optimizedMessageDispatch = true;
copyMessageOnSend = true;
useCompression;
objectMessageSerializationDefered;
useAsyncSend;
optimizeAcknowledge;
closeTimeout = 15000;
useRetroactiveConsumer;
exclusiveConsumer;
nestedMapAndListEnabled = true;
alwaysSyncSend;
watchTopicAdvisories = true;
producerWindowSize = DEFAULT_PRODUCER_WINDOW_SIZE;
warnAboutUnstartedConnectionTimeout = 500L;
sendTimeout =0;
sendAcksAsync=true;





Meise, Christoph wrote:
> 
> Some additions.
> 
> Have a look at
> http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java?view=markup
> -> createCamelContext(). You can find usages there. For me the following
> was minimum to configure maxReconnectAttempts:
> 
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
> 		<property name="brokerURL"
> value="tcp://localhost:61616?jms.useAsyncSend=false&jms.maxReconnectAttempts=1"/>
> 	</bean>
> 
> Regards
> Christoph
>  
> 
> -----Ursprüngliche Nachricht-----
> Von: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
> Gesendet: Donnerstag, 29. April 2010 12:52
> An: users@camel.apache.org
> Betreff: Re: AW: activemq component MaxConnection retry
> 
> Hi
> 
> broker. is for embedding a AMQ broker.
> 
> What he is doing is connecting to an existing remote AMQ broker.
> I think there is a connection. prefix as well you can use, but I am not
> sure
> 
>                 <property name="brokerURL"
>  value="tcp://localhost:61616?connection.maxReconnectAttempts=3"/>
> 
> If not you may have to add a 2nd spring bean for the
> AMQConnectionFactory and declare the options on it directly.
> And then refer to this factory bean in the AMQ component.
> 
> Yes we should have the wiki documentation updated with a working example.
> 
> 
> 
> 
> On Thu, Apr 29, 2010 at 12:25 PM, ssenth <se...@eur.ko.com> wrote:
>>
>> HI Christoph,
>>
>> I did the following     <bean id="activemq"
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>                <property name="brokerURL"
>> value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
>>        </bean>
>>
>> But still getting the error  as show below
>>
>> Message:
>> Uncategorized exception occured during JMS processing; nested exception
>> is
>> javax.jms.JMSException: Could not create Transport. Reason:
>> java.lang.IllegalArgumentException: Invalid connect parameters:
>> {broker.maxReconnectAttempts=3}
>> Throwable:
>> org.springframework.jms.UncategorizedJmsException: Uncategorized
>> exception
>> occured during JMS processing; nested exception is
>> javax.jms.JMSException:
>> Could not create Transport. Reason: java.lang.IllegalArgumentException:
>> Invalid connect parameters: {broker.maxReconnectAttempts=3}
>>        at
>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>        at
>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>        at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>        at
>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
>>        at
>> org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
>>        at
>> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
>>        at
>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
>>        at
>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
>>        at
>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
>>        at
>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
>>        at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
>>        at
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>>        at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>        at
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>        at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>        at
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>
>> Can you please let me know if you have an idea.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28398843.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28408488.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: AW: activemq component MaxConnection retry

Posted by "Meise, Christoph" <ch...@immobilienscout24.de>.
Some additions.

Have a look at http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java?view=markup -> createCamelContext(). You can find usages there. For me the following was minimum to configure maxReconnectAttempts:

<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="brokerURL"
value="tcp://localhost:61616?jms.useAsyncSend=false&jms.maxReconnectAttempts=1"/>
	</bean>

Regards
Christoph
 

-----Ursprüngliche Nachricht-----
Von: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Gesendet: Donnerstag, 29. April 2010 12:52
An: users@camel.apache.org
Betreff: Re: AW: activemq component MaxConnection retry

Hi

broker. is for embedding a AMQ broker.

What he is doing is connecting to an existing remote AMQ broker.
I think there is a connection. prefix as well you can use, but I am not sure

                <property name="brokerURL"
 value="tcp://localhost:61616?connection.maxReconnectAttempts=3"/>

If not you may have to add a 2nd spring bean for the
AMQConnectionFactory and declare the options on it directly.
And then refer to this factory bean in the AMQ component.

Yes we should have the wiki documentation updated with a working example.




On Thu, Apr 29, 2010 at 12:25 PM, ssenth <se...@eur.ko.com> wrote:
>
> HI Christoph,
>
> I did the following     <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="brokerURL"
> value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
>        </bean>
>
> But still getting the error  as show below
>
> Message:
> Uncategorized exception occured during JMS processing; nested exception is
> javax.jms.JMSException: Could not create Transport. Reason:
> java.lang.IllegalArgumentException: Invalid connect parameters:
> {broker.maxReconnectAttempts=3}
> Throwable:
> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
> occured during JMS processing; nested exception is javax.jms.JMSException:
> Could not create Transport. Reason: java.lang.IllegalArgumentException:
> Invalid connect parameters: {broker.maxReconnectAttempts=3}
>        at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>        at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>        at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
>        at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
>        at
> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
>        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
>        at
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
>        at
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
>        at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
>        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
>        at
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>        at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>        at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>        at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>
> Can you please let me know if you have an idea.
>
> --
> View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28398843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: AW: activemq component MaxConnection retry

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

broker. is for embedding a AMQ broker.

What he is doing is connecting to an existing remote AMQ broker.
I think there is a connection. prefix as well you can use, but I am not sure

                <property name="brokerURL"
 value="tcp://localhost:61616?connection.maxReconnectAttempts=3"/>

If not you may have to add a 2nd spring bean for the
AMQConnectionFactory and declare the options on it directly.
And then refer to this factory bean in the AMQ component.

Yes we should have the wiki documentation updated with a working example.




On Thu, Apr 29, 2010 at 12:25 PM, ssenth <se...@eur.ko.com> wrote:
>
> HI Christoph,
>
> I did the following     <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="brokerURL"
> value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
>        </bean>
>
> But still getting the error  as show below
>
> Message:
> Uncategorized exception occured during JMS processing; nested exception is
> javax.jms.JMSException: Could not create Transport. Reason:
> java.lang.IllegalArgumentException: Invalid connect parameters:
> {broker.maxReconnectAttempts=3}
> Throwable:
> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
> occured during JMS processing; nested exception is javax.jms.JMSException:
> Could not create Transport. Reason: java.lang.IllegalArgumentException:
> Invalid connect parameters: {broker.maxReconnectAttempts=3}
>        at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>        at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>        at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
>        at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
>        at
> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
>        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
>        at
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
>        at
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
>        at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
>        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
>        at
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>        at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>        at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>        at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>
> Can you please let me know if you have an idea.
>
> --
> View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28398843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: AW: activemq component MaxConnection retry

Posted by ssenth <se...@eur.ko.com>.
HI Christoph,

I did the following 	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="brokerURL"
value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
	</bean>

But still getting the error  as show below

Message:
Uncategorized exception occured during JMS processing; nested exception is
javax.jms.JMSException: Could not create Transport. Reason:
java.lang.IllegalArgumentException: Invalid connect parameters:
{broker.maxReconnectAttempts=3}
Throwable:
org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
Could not create Transport. Reason: java.lang.IllegalArgumentException:
Invalid connect parameters: {broker.maxReconnectAttempts=3}
	at
org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
	at
org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
	at
org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
	at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
	at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
	at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
	at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)

Can you please let me know if you have an idea.

-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28398843.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: activemq component MaxConnection retry

Posted by "Meise, Christoph" <ch...@immobilienscout24.de>.
Hi,

try 
	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
	     <property name="brokerURL"
value="tcp://localhost:61616?broker.maxReconnectAttempts=3"/>
	</bean>

Regards,
Christoph

-----Ursprüngliche Nachricht-----
Von: ssenth [mailto:seshanmugham@eur.ko.com] 
Gesendet: Mittwoch, 28. April 2010 13:53
An: users@camel.apache.org
Betreff: Re: activemq component MaxConnection retry


Claus,

Now the changed the bean definition as shown below

	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
	     <property name="brokerURL"
value="tcp://localhost:61616?maxReconnectAttempts=3"/>
	</bean>

But getting the below error(java.lang.IllegalArgumentException: Invalid
connect parameters: {maxReconnectAttempts=3}). I Guess ,  can set the
properties available in the ActiveMQConnectionFactory example sendTimeout,
warnAboutUnstartedConnectionTimeout etc. Not sure how do we set the
maxReconectAttempt when the connection is not available. or is there a
perperyt in ActiveMQConnectionFactory which will restrict the number of
reconnect attempts.


org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
Could not create Transport. Reason: java.lang.IllegalArgumentException:
Invalid connect parameters: {maxReconnectAttempts=3}	at
org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
	at
org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
	at
org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
	at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
	at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
	at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
	at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
	at
com.ko.bonpc.camel.C4BComponent.processForConsumers(C4BComponent.java:136)
	at com.ko.bonpc.camel.C4BComponent.send(C4BComponent.java:107)
	at com.ko.bonpc.camel.C4B.send(C4B.java:90)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.send(BonPCSendTestRunner.java:116)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.sendToBonPC(BonPCSendTestRunner.java:111)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.process(BonPCSendTestRunner.java:81)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.main(BonPCSendTestRunner.java:43)
Caused by: javax.jms.JMSException: Could not create Transport. Reason:
java.lang.IllegalArgumentException: Invalid connect parameters:
{maxReconnectAttempts=3}
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:239)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:252)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224)
	at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:125)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:110)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:81)
	at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:461)
	... 25 more
Caused by: java.lang.IllegalArgumentException: Invalid connect parameters:
{maxReconnectAttempts=3}
	at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:144)
	at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51)
	at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237)
	... 33 more
-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28387714.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: activemq component MaxConnection retry

Posted by ssenth <se...@eur.ko.com>.
Claus,

Now the changed the bean definition as shown below

	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
	     <property name="brokerURL"
value="tcp://localhost:61616?maxReconnectAttempts=3"/>
	</bean>

But getting the below error(java.lang.IllegalArgumentException: Invalid
connect parameters: {maxReconnectAttempts=3}). I Guess ,  can set the
properties available in the ActiveMQConnectionFactory example sendTimeout,
warnAboutUnstartedConnectionTimeout etc. Not sure how do we set the
maxReconectAttempt when the connection is not available. or is there a
perperyt in ActiveMQConnectionFactory which will restrict the number of
reconnect attempts.


org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
Could not create Transport. Reason: java.lang.IllegalArgumentException:
Invalid connect parameters: {maxReconnectAttempts=3}	at
org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
	at
org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:193)
	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:371)
	at
org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:316)
	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
	at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
	at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:73)
	at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
	at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
	at
com.ko.bonpc.camel.C4BComponent.processForConsumers(C4BComponent.java:136)
	at com.ko.bonpc.camel.C4BComponent.send(C4BComponent.java:107)
	at com.ko.bonpc.camel.C4B.send(C4B.java:90)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.send(BonPCSendTestRunner.java:116)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.sendToBonPC(BonPCSendTestRunner.java:111)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.process(BonPCSendTestRunner.java:81)
	at
com.ko.bonpc.test.camel.BonPCSendTestRunner.main(BonPCSendTestRunner.java:43)
Caused by: javax.jms.JMSException: Could not create Transport. Reason:
java.lang.IllegalArgumentException: Invalid connect parameters:
{maxReconnectAttempts=3}
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:239)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:252)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224)
	at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:125)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:110)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:81)
	at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:461)
	... 25 more
Caused by: java.lang.IllegalArgumentException: Invalid connect parameters:
{maxReconnectAttempts=3}
	at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:144)
	at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51)
	at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237)
	... 33 more
-- 
View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28387714.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: activemq component MaxConnection retry

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think you can put it in the brokerURL as a uri parameter as shown here
http://camel.apache.org/activemq.html



On Wed, Apr 28, 2010 at 11:35 AM, ssenth <se...@eur.ko.com> wrote:
>
> Hi,
> I am using the below route to put the message in an ActiveMQ queue
>
> Bean Declaration        <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="connectionFactory">
>                        <bean class="org.apache.activemq.ActiveMQConnectionFactory"/>
>                </property>
>        </bean>
>
> Routing
>        <route>
>                <from uri="customComponent:Partner2"/>
>                <to uri="activemq:queue:TargetQueue"/>
>        </route>
>
> I did send two messages which reached the TargetQueue in ActiveMQ, but when
> I stopped the activemq and send the third message, CAMLE did not time
> out/stop instead it continuously tries to reconnect to ActiveMQ. Can any one
> let me know how or hing on how to configure the route to stop the CAMEL
> context after let's say 3 reconnect attempts and backup the message to a
> folder.
>
> Did find maxReconnectAttempts and startupMaxReconnectAttempts in
> org.apache.activemq.transport.failover.FailoverTransport , but could not
> figure out how to set these properties.
>
>
> Below is the log4jenties
>
> Time: 2:24:32 PM  Priority: DEBUG  Thread: ActiveMQ Task  NDC: null
> Category: org.apache.activemq.transport.failover.FailoverTransport Location:
> org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:722)
> Message:
> Connect fail to: tcp://localhost:61616, reason: java.net.ConnectException:
> Connection refused: connect
> Throwable:
> null
>
> Time: 2:24:32 PM  Priority: DEBUG  Thread: ActiveMQ Task  NDC: null
> Category: org.apache.activemq.transport.failover.FailoverTransport Location:
> org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:756)
> Message:
> Waiting 30000 ms before attempting connection.
> Throwable:
> null
>
> Time: 2:24:32 PM  Priority: DEBUG  Thread: main  NDC: null Category:
> org.apache.activemq.transport.failover.FailoverTransport Location:
> org.apache.activemq.transport.failover.FailoverTransport.oneway(FailoverTransport.java:406)
> Message:
> Waiting for transport to reconnect.
> Throwable:
> null
> --
> View this message in context: http://old.nabble.com/activemq-component-MaxConnection-retry-tp28386612p28386612.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus