You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yaog <ya...@gmail.com> on 2010/01/11 14:29:58 UTC

fail over does not work with jms???

If I define a route like this:

		<route id="route1">
			<from uri="direct:start" />
			<to uri="bean:compAImpl" />
			<loadBalance>
				<camel:failover/>
				<to uri="bean:compBImpl" />
				<to uri="bean:compCImpl" />
			</loadBalance>
		</route>

and comp B throw exception, failing over to C works ok.

how ever, if I define this route:

		<route id="route1">
			<from uri="direct:start" />
			<to uri="bean:compAImpl" />
			<loadBalance>
				<camel:failover/>
				<to uri="jms:compB" />
				<to uri="jms:compC" />
			</loadBalance>
		</route>


		<route id="route2">
			<from uri="jms:compB" />
			<to uri="bean:compBImpl" />
		</route>

		<route id="route3">
			<from uri="jms:compC" />
			<to uri="bean:compCImpl" />
		</route>


and compB throw an exception, then the exception is logged but C is not
invoked.

can't fail over recover from failures after consumed by the jms queue?

will adding a transaction manager aid here?
-- 
View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27110432.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fail over does not work with jms???

Posted by yaog <ya...@gmail.com>.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Please always write which version of Camel you are using?
> Each new version is greatly improved over the previous.
> 
> 

Using latest Camel - 2.1.0

-- 
View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27111104.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fail over does not work with jms???

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

Please always write which version of Camel you are using?
Each new version is greatly improved over the previous.


On Mon, Jan 11, 2010 at 2:29 PM, yaog <ya...@gmail.com> wrote:
>
> If I define a route like this:
>
>                <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <loadBalance>
>                                <camel:failover/>
>                                <to uri="bean:compBImpl" />
>                                <to uri="bean:compCImpl" />
>                        </loadBalance>
>                </route>
>
> and comp B throw exception, failing over to C works ok.
>
> how ever, if I define this route:
>
>                <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <loadBalance>
>                                <camel:failover/>
>                                <to uri="jms:compB" />
>                                <to uri="jms:compC" />
>                        </loadBalance>
>                </route>
>
>
>                <route id="route2">
>                        <from uri="jms:compB" />
>                        <to uri="bean:compBImpl" />
>                </route>
>
>                <route id="route3">
>                        <from uri="jms:compC" />
>                        <to uri="bean:compCImpl" />
>                </route>
>
>
> and compB throw an exception, then the exception is logged but C is not
> invoked.
>
> can't fail over recover from failures after consumed by the jms queue?
>
> will adding a transaction manager aid here?
> --
> View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27110432.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: How to inject a custom ManagedProcessor into camel?

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

I cannot recall whether custom Processor can be managed out of the box.
Its meant for components, endpoints etc.

What you need is to implement the ManagementAware in your custom Processor.

See more here: (in the bottom)
http://camel.apache.org/camel-jmx.html

I will later cover such a scenario in chapter 11 of the Camel book,
but haven't got so far yet.


On Tue, Jan 12, 2010 at 11:46 AM, ext2 <xu...@tongtech.com> wrote:
> Hi:
>        Camel has provide  management feature. But how I could extend it?
>        I have noticed the camel provide managed object(etc:
> ManagedProcessor),  will be very useful to extend the management feature.
> But if I write a custom ManagedProcessor  , could I inject it in
> camelContext(tell camelcontext to create managedObject using the customed
> managed object)?
>
> Thanks for any-suggestion
>
>
>
>



-- 
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

How to inject a custom ManagedProcessor into camel?

Posted by ext2 <xu...@tongtech.com>.
Hi:
	Camel has provide  management feature. But how I could extend it?
	I have noticed the camel provide managed object(etc:
ManagedProcessor),  will be very useful to extend the management feature.
But if I write a custom ManagedProcessor  , could I inject it in
camelContext(tell camelcontext to create managedObject using the customed
managed object)? 

Thanks for any-suggestion




Re: fail over does not work with jms???

Posted by yaog <ya...@gmail.com>.
You are correct.

Splitting the jms listeners to different routes makes it work for me too.
-- 
View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27123354.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fail over does not work with jms???

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 3:15 PM, yaog <ya...@gmail.com> wrote:
>
> From what I understood from the docs the exception list is not mandatory (it
> says explicitly: "If you do not specify any exceptions it will failover over
> any exceptions").
>
> To support the above, please note:
>
> 1. After adding exception in the spring file, still doesn't work.
> 2. Worked with regular beans (no jms) even though no exception was detailed
> in the xml.
> 3. The schema does not mandate this xml node...
>
> Please advise.

See these unit test I just added, they work with failover over JMS
http://svn.apache.org/viewvc?rev=897907&view=rev


> --
> View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27111084.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: fail over does not work with jms???

Posted by yaog <ya...@gmail.com>.
>From what I understood from the docs the exception list is not mandatory (it
says explicitly: "If you do not specify any exceptions it will failover over
any exceptions").

To support the above, please note:

1. After adding exception in the spring file, still doesn't work.
2. Worked with regular beans (no jms) even though no exception was detailed
in the xml.
3. The schema does not mandate this xml node...

Please advise.
-- 
View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27111084.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fail over does not work with jms???

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

You *must* set some exception the failover should loadbalance
http://camel.apache.org/load-balancer.html

  <loadBalance>
          <failover>
              <exception>java.io.IOException</exception>
              <exception>com.mycompany.MyOtherException</exception>
          </failover>
          <to uri="direct:a"/>
          <to uri="direct:b"/>
      </loadBalance>

I do think however we should add a silent default that if none
provided it will failover.


On Mon, Jan 11, 2010 at 2:58 PM, yaog <ya...@gmail.com> wrote:
>
> Adding this option still does not work. Looks like the problematic request
> get's lost.
>
> Here is a snippet from the log:
>
> [DefaultErrorHandler] [DefaultMessageListenerContainer-1]:  DEBUG: Failed
> delivery for exchangeId: ID:yogenLT1-4138-1263218053203-2:7:1:1:1. On
> delivery attempt: 0 caught: java.lang.RuntimeException: testing failover!
> [DefaultErrorHandler] [DefaultMessageListenerContainer-1]:  DEBUG: This
> exchange is not handled so its marked as failed: Exchange[JmsMessage:
> ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
> ID:yogenLT1-4138-1263218053203-2:7:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:yogenLT1-4138-1263218053203-2:7:1:1, destination = queue://compB,
> transactionId = null, expiration = 0, timestamp = 1263218054671, arrival =
> 0, brokerInTime = 1263218054671, brokerOutTime = 1263218054671,
> correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content = null, marshalledProperties =
> org.apache.activemq.util.ByteSequence@6147d9, dataStructure = null,
> redeliveryCounter = 0, size = 0, properties =
> {CamelBeanMultiParameterArray=false}, readOnlyProperties = true,
> readOnlyBody = true, droppable = false, text = In A: GO HA 5}]
>
> in bold the exception thrown and log about message failing. why no
> failover???
> --
> View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27110764.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: fail over does not work with jms???

Posted by yaog <ya...@gmail.com>.
Adding this option still does not work. Looks like the problematic request
get's lost.

Here is a snippet from the log:

[DefaultErrorHandler] [DefaultMessageListenerContainer-1]:  DEBUG: Failed
delivery for exchangeId: ID:yogenLT1-4138-1263218053203-2:7:1:1:1. On
delivery attempt: 0 caught: java.lang.RuntimeException: testing failover!
[DefaultErrorHandler] [DefaultMessageListenerContainer-1]:  DEBUG: This
exchange is not handled so its marked as failed: Exchange[JmsMessage:
ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
ID:yogenLT1-4138-1263218053203-2:7:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:yogenLT1-4138-1263218053203-2:7:1:1, destination = queue://compB,
transactionId = null, expiration = 0, timestamp = 1263218054671, arrival =
0, brokerInTime = 1263218054671, brokerOutTime = 1263218054671,
correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
org.apache.activemq.util.ByteSequence@6147d9, dataStructure = null,
redeliveryCounter = 0, size = 0, properties =
{CamelBeanMultiParameterArray=false}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = In A: GO HA 5}]

in bold the exception thrown and log about message failing. why no
failover???
-- 
View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27110764.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fail over does not work with jms???

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 2:29 PM, yaog <ya...@gmail.com> wrote:
>
> If I define a route like this:
>
>                <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <loadBalance>
>                                <camel:failover/>
>                                <to uri="bean:compBImpl" />
>                                <to uri="bean:compCImpl" />
>                        </loadBalance>
>                </route>
>
> and comp B throw exception, failing over to C works ok.
>
> how ever, if I define this route:
>
>                <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <loadBalance>
>                                <camel:failover/>
>                                <to uri="jms:compB" />
>                                <to uri="jms:compC" />
>                        </loadBalance>
>                </route>
>
>
>                <route id="route2">
>                        <from uri="jms:compB" />
>                        <to uri="bean:compBImpl" />
>                </route>
>
>                <route id="route3">
>                        <from uri="jms:compC" />
>                        <to uri="bean:compCImpl" />
>                </route>
>
>
> and compB throw an exception, then the exception is logged but C is not
> invoked.
>
> can't fail over recover from failures after consumed by the jms queue?
>

Exceptions cannot normally be transferred over JMS. Its just an
exchange of the payload.
You cannot always assume both sides of JMS have the same classes on
the classpath.
But since you do some testing I assume you run all in the same JVM.

You can enable the transferException=true option on the JMS endpoint
to let it transfer exceptions over JMS.
Then the failover should work.



> will adding a transaction manager aid here?
> --
> View this message in context: http://old.nabble.com/fail-over-does-not-work-with-jms----tp27110432p27110432.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