You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by baklarz <td...@gmail.com> on 2011/11/22 13:17:17 UTC
errorHandler for activemq component example configuration
I'm tried several configurations. Exceptions inside jms/activemq are
completly ignored by camel arror handler.
This line in log drives me crazy.
2011-11-22 12:59:11,700 WARN
[org.apache.camel.component.jms.JmsMessageListenerContainer] - <Execution of
JMS message listener failed, and no ErrorHandler has been set.>
I found this
http://mail-archives.apache.org/mod_mbox/activemq-users/201105.mbox/%3CBANLkTi=pDeUdjZopqAGg0HkCaTAZBq8Pgg@mail.gmail.com%3E
How to setup route,error handling to catch exceptions "inside" activeqm
propagation and resend it again to queue ?
Is it possible inside camel context ?
<camelContext xmlns="http://camel.apache.org/schema/spring">
<onException>
<exception>org.apache.camel.RuntimeCamelException</exception>
<exception>org.springframework.mail.MailSendException</exception>
<exception>javax.mail.MessagingException</exception>
<redeliveryPolicy maximumRedeliveries="1"
redeliveryDelay="30000"/>
<camel:handled>
<camel:constant>true</camel:constant>
</camel:handled>
<to uri="activemq:queue:businessFailed"/>
</onException>
<route>
<from uri="activemq:queue:ThankYou.EndDonationSuccessEvent" />
<delay>
<constant>30000</constant>
</delay>
<bean ref="emailTranslator" method="prepareThankYouEmail" />
<to uri="activemq:queue:QUEUE.EMAIL_NOTIFICATIONS" />
</route>
</camelContext>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL"
value="failover:(tcp://mq-1:61616,tcp://mq-2:61616)?timeout=3000&randomize=false"
/>
</bean>
</property>
</bean>
I'm using apache-camel 2.8.2
--
View this message in context: http://camel.465427.n5.nabble.com/errorHandler-for-activemq-component-example-configuration-tp5013373p5013373.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: errorHandler for activemq component example configuration
Posted by bergun <ba...@gmail.com>.
Great explanation thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/errorHandler-for-activemq-component-example-configuration-tp5013373p5747305.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: errorHandler for activemq component example configuration
Posted by "kraythe ." <kr...@gmail.com>.
With any JMS system if you send a message using request-reply the broker
will utilize one of many options for replying to you. Either a temporary
queue just for you or a community topic by which you can use your
correlation ID to pluck out the reply. There are other options as well.
>From the point of view of camel, send an exchange to the ActiveMQ component
with the exchange pattern of InOut and it will manage the details for you.
i.e.
from("activemq:queue:inbox).to(ExchangePattern.InOut,
"activemq:queue:destination).log("Reply is: ${body}");
This will send the message, wait for another route to pick up and process
the message and send the reply from the other route back so it can be
logged.
*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
On Thu, Feb 13, 2014 at 8:59 AM, bergun <ba...@gmail.com> wrote:
> "If using AMQ you can enable sync sending," I am trying to work out how
> this
> can be done from Jms Options. I tried to grep with sycnhronous keyword but
> couldnt find it really. Appreciate if you can tell how this can be
> achieved.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/errorHandler-for-activemq-component-example-configuration-tp5013373p5747262.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: errorHandler for activemq component example configuration
Posted by bergun <ba...@gmail.com>.
"If using AMQ you can enable sync sending," I am trying to work out how this
can be done from Jms Options. I tried to grep with sycnhronous keyword but
couldnt find it really. Appreciate if you can tell how this can be achieved.
--
View this message in context: http://camel.465427.n5.nabble.com/errorHandler-for-activemq-component-example-configuration-tp5013373p5747262.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: errorHandler for activemq component example configuration
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Nov 22, 2011 at 1:17 PM, baklarz <td...@gmail.com> wrote:
> I'm tried several configurations. Exceptions inside jms/activemq are
> completly ignored by camel arror handler.
>
> This line in log drives me crazy.
> 2011-11-22 12:59:11,700 WARN
> [org.apache.camel.component.jms.JmsMessageListenerContainer] - <Execution of
> JMS message listener failed, and no ErrorHandler has been set.>
>
> I found this
> http://mail-archives.apache.org/mod_mbox/activemq-users/201105.mbox/%3CBANLkTi=pDeUdjZopqAGg0HkCaTAZBq8Pgg@mail.gmail.com%3E
>
>
> How to setup route,error handling to catch exceptions "inside" activeqm
> propagation and resend it again to queue ?
> Is it possible inside camel context ?
>
You can configure an errorHandler on the JMS endpoint, there is an
errorHandler option.
Mind that this errorHandler is Spring / JMS specific.
And its just a callback if an exception occurred. And its not tied
back to the Camel routing engine.
There is a JIRA ticket to look into whether that is possible. The
problem is the async nature of JMS, and the API of the errorHandler.
If using AMQ you can enable sync sending, which means any error during
sending will be propagated back. And Camel can react upon it.
> <camelContext xmlns="http://camel.apache.org/schema/spring">
> <onException>
> <exception>org.apache.camel.RuntimeCamelException</exception>
>
> <exception>org.springframework.mail.MailSendException</exception>
> <exception>javax.mail.MessagingException</exception>
> <redeliveryPolicy maximumRedeliveries="1"
> redeliveryDelay="30000"/>
> <camel:handled>
> <camel:constant>true</camel:constant>
> </camel:handled>
> <to uri="activemq:queue:businessFailed"/>
> </onException>
>
> <route>
> <from uri="activemq:queue:ThankYou.EndDonationSuccessEvent" />
> <delay>
> <constant>30000</constant>
> </delay>
> <bean ref="emailTranslator" method="prepareThankYouEmail" />
>
> <to uri="activemq:queue:QUEUE.EMAIL_NOTIFICATIONS" />
>
> </route>
>
> </camelContext>
>
>
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>
> <property name="connectionFactory">
> <bean class="org.apache.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL"
>
> value="failover:(tcp://mq-1:61616,tcp://mq-2:61616)?timeout=3000&randomize=false"
> />
> </bean>
> </property>
> </bean>
>
> I'm using apache-camel 2.8.2
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/errorHandler-for-activemq-component-example-configuration-tp5013373p5013373.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/