You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by selezovikj <se...@gmail.com> on 2008/10/08 16:38:17 UTC

Camel Routing - Spring Configuration

I want to route a message from a queue "numbers" to three queues. I want all
three queues to receive the very same message, so that later each queue can
send the message to a corresponding bean. 
 I did the route in Camel DSL. 
My question is how would I configure the following route written in the
Camel DSL to a route in Spring: 

from("jms:numbers").to("jms:queue:Queue1", "jms:queue:Queue2",
"jms:queue:Queue3");
from("jms:queue:andysQueue3").to("bean:multiplier2");
------------------------------------------------------------------------------------------------------
Possible Spring configurations: 

1:
<camelContext id="camel"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<route>
			<from uri="jms:numbers"/>
			<to uri="jms:Queue1", "jms:Queue2", "jms:Queue3"/>
		</route>
</camelContext>

2:
<camelContext id="camel"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<route>
			<from uri="jms:numbers"/>
			<to uri="jms:Queue1"/>
		</route>
                <route>
			<from uri="jms:numbers"/>
			<to uri="jms:Queue2"/>
		</route>
                <route>
			<from uri="jms:numbers"/>
			<to uri="jms:Queue3"/>
		</route>
</camelContext>

3: 
Create three separate camelContexts, each one containing a route. 

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19880117.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by Jonathan Anstey <ja...@gmail.com>.
selezovikj wrote:
> Problem solved. There is no bug at all.

Great!!

>  
> It seems that the remote active MQ broker had problems. 
> And yes, you are right, the multicast keyword is mandatory for both java DSL
> and camel DSL, if we want to send the same message to multiple queues. 
> If the multicast keyword is not specified, it is regarded as pipeline. 
>
> Thank you for your time. 
>   

You are most welcome :)

>
> janstey wrote:
>   
>> Since I can't reproduce your issue, would you mind doing up a test case 
>> and attaching it to a JIRA issue?  That will speed up the process of 
>> fixing this.
>>
>> selezovikj wrote:
>>     
>>> I don't think that there is a problem with Camel, because when I try
>>> running
>>> my application with having my routes written in the Java DSL, WITHOUT
>>> using
>>> the multicast keyword, every queue of the static recipient list
>>> successfully
>>> receives the message. 
>>>
>>> The problem occurs, when I define the routing in Spring. 
>>> When I don't use the multicast keyword, only the first queue receives the
>>> message. 
>>> When I use the multicast keyword, none of the queue receives the message. 
>>>
>>> Errors: 
>>>
>>> org.apache.camel.RuntimeCamelException:
>>> org.apache.camel.component.jms.RuntimeJmsException: Failed to extract
>>> body
>>> due to: javax.jms.JMSException: Failed to build body from bytes. Reason:
>>> java.io.IOException
>>>
>>> Caused by: javax.jms.JMSException: Failed to build body from bytes.
>>> Reason:
>>> java.io.IOException
>>>
>>>
>>>
>>> janstey wrote:
>>>   
>>>       
>>>> Yeah, 1.5 hasn't been released yet so its still changing quite a bit. 
>>>> But this may be a bug in Camel 1.4.
>>>>
>>>> By the way, in my test I used the activemq component rather that the jms 
>>>> component to send to queues. So, something like this:
>>>>
>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>        xmlns:amq="http://activemq.apache.org/schema/core"
>>>>        xsi:schemaLocation="
>>>>        http://www.springframework.org/schema/beans 
>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>        http://activemq.apache.org/camel/schema/spring 
>>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
>>>>        http://activemq.apache.org/schema/core 
>>>> http://activemq.apache.org/schema/core/activemq-core.xsd">
>>>>
>>>>   <broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" 
>>>> persistent="false">
>>>>     <transportConnectors>
>>>>       <transportConnector uri="tcp://localhost:61616" />
>>>>     </transportConnectors>
>>>>   </broker>
>>>>
>>>>   <bean id="activemq" 
>>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>>     <property name="brokerURL" value="tcp://localhost:61616"/>
>>>>   </bean>
>>>>
>>>>   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>     <package>org.apache.camel.testmulticast</package>
>>>>     <route>
>>>>       <from uri="activemq:tempqueue"/>
>>>>       <multicast>
>>>>         <to uri="activemq:personnel.records1"/>
>>>>         <to uri="activemq:personnel.records2"/>       
>>>>       </multicast>
>>>>     </route>   
>>>> ...
>>>>  
>>>>
>>>> selezovikj wrote:
>>>>     
>>>>         
>>>>> I am running ActiveMQ 5.1.0 and Camel 1.4.
>>>>> I thought that Camel 1.5 was not stable
>>>>>
>>>>>
>>>>> janstey wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT
>>>>>> and 
>>>>>> all seems to work fine. Whats your JMS broker/version and Camel
>>>>>> version?
>>>>>>
>>>>>> selezovikj wrote:
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> I actually tested the Java DSL and it works without the "multicast"
>>>>>>> keyword. 
>>>>>>>
>>>>>>> In the camel DSL, without using the multicast keyword it only send to
>>>>>>> Queue1. 
>>>>>>> When I use the multicast keyword it does not send to any queues. 
>>>>>>> And it gives an error like: 
>>>>>>>
>>>>>>> Can't build body from bytes. 
>>>>>>>
>>>>>>> Error at
>>>>>>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>>>>>>
>>>>>>> Do you have any idea why is this so ? 
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> janstey wrote:
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>>> Actually, looks like the docs are a bit misleading. If you want the
>>>>>>>> same
>>>>>>>> message routed to all destinations, you'll need to wrap the outputs
>>>>>>>> in
>>>>>>>> a
>>>>>>>> multicast element
>>>>>>>>
>>>>>>>> <route>
>>>>>>>>   <from uri="jms:numbers"/>
>>>>>>>>   <multicast>
>>>>>>>>     <to uri="jms:Queue1"/>
>>>>>>>>     <to uri="jms:Queue2"/>
>>>>>>>>     <to uri="jms:Queue3"/>
>>>>>>>>   </multicast>
>>>>>>>> </route>
>>>>>>>>
>>>>>>>> and also modify your Java DSL to
>>>>>>>>
>>>>>>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>>>>>>> "jms:queue:Queue2",
>>>>>>>> "jms:queue:Queue3");
>>>>>>>>
>>>>>>>>
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>
>>     
>
>   


Re: Camel Routing - Spring Configuration

Posted by selezovikj <se...@gmail.com>.
Problem solved. There is no bug at all. 
It seems that the remote active MQ broker had problems. 
And yes, you are right, the multicast keyword is mandatory for both java DSL
and camel DSL, if we want to send the same message to multiple queues. 
If the multicast keyword is not specified, it is regarded as pipeline. 

Thank you for your time. 


janstey wrote:
> 
> Since I can't reproduce your issue, would you mind doing up a test case 
> and attaching it to a JIRA issue?  That will speed up the process of 
> fixing this.
> 
> selezovikj wrote:
>> I don't think that there is a problem with Camel, because when I try
>> running
>> my application with having my routes written in the Java DSL, WITHOUT
>> using
>> the multicast keyword, every queue of the static recipient list
>> successfully
>> receives the message. 
>>
>> The problem occurs, when I define the routing in Spring. 
>> When I don't use the multicast keyword, only the first queue receives the
>> message. 
>> When I use the multicast keyword, none of the queue receives the message. 
>>
>> Errors: 
>>
>> org.apache.camel.RuntimeCamelException:
>> org.apache.camel.component.jms.RuntimeJmsException: Failed to extract
>> body
>> due to: javax.jms.JMSException: Failed to build body from bytes. Reason:
>> java.io.IOException
>>
>> Caused by: javax.jms.JMSException: Failed to build body from bytes.
>> Reason:
>> java.io.IOException
>>
>>
>>
>> janstey wrote:
>>   
>>> Yeah, 1.5 hasn't been released yet so its still changing quite a bit. 
>>> But this may be a bug in Camel 1.4.
>>>
>>> By the way, in my test I used the activemq component rather that the jms 
>>> component to send to queues. So, something like this:
>>>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>        xmlns:amq="http://activemq.apache.org/schema/core"
>>>        xsi:schemaLocation="
>>>        http://www.springframework.org/schema/beans 
>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>        http://activemq.apache.org/camel/schema/spring 
>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
>>>        http://activemq.apache.org/schema/core 
>>> http://activemq.apache.org/schema/core/activemq-core.xsd">
>>>
>>>   <broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" 
>>> persistent="false">
>>>     <transportConnectors>
>>>       <transportConnector uri="tcp://localhost:61616" />
>>>     </transportConnectors>
>>>   </broker>
>>>
>>>   <bean id="activemq" 
>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>     <property name="brokerURL" value="tcp://localhost:61616"/>
>>>   </bean>
>>>
>>>   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>>     <package>org.apache.camel.testmulticast</package>
>>>     <route>
>>>       <from uri="activemq:tempqueue"/>
>>>       <multicast>
>>>         <to uri="activemq:personnel.records1"/>
>>>         <to uri="activemq:personnel.records2"/>       
>>>       </multicast>
>>>     </route>   
>>> ...
>>>  
>>>
>>> selezovikj wrote:
>>>     
>>>> I am running ActiveMQ 5.1.0 and Camel 1.4.
>>>> I thought that Camel 1.5 was not stable
>>>>
>>>>
>>>> janstey wrote:
>>>>   
>>>>       
>>>>> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT
>>>>> and 
>>>>> all seems to work fine. Whats your JMS broker/version and Camel
>>>>> version?
>>>>>
>>>>> selezovikj wrote:
>>>>>     
>>>>>         
>>>>>> I actually tested the Java DSL and it works without the "multicast"
>>>>>> keyword. 
>>>>>>
>>>>>> In the camel DSL, without using the multicast keyword it only send to
>>>>>> Queue1. 
>>>>>> When I use the multicast keyword it does not send to any queues. 
>>>>>> And it gives an error like: 
>>>>>>
>>>>>> Can't build body from bytes. 
>>>>>>
>>>>>> Error at
>>>>>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>>>>>
>>>>>> Do you have any idea why is this so ? 
>>>>>>
>>>>>>
>>>>>>
>>>>>> janstey wrote:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> Actually, looks like the docs are a bit misleading. If you want the
>>>>>>> same
>>>>>>> message routed to all destinations, you'll need to wrap the outputs
>>>>>>> in
>>>>>>> a
>>>>>>> multicast element
>>>>>>>
>>>>>>> <route>
>>>>>>>   <from uri="jms:numbers"/>
>>>>>>>   <multicast>
>>>>>>>     <to uri="jms:Queue1"/>
>>>>>>>     <to uri="jms:Queue2"/>
>>>>>>>     <to uri="jms:Queue3"/>
>>>>>>>   </multicast>
>>>>>>> </route>
>>>>>>>
>>>>>>> and also modify your Java DSL to
>>>>>>>
>>>>>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>>>>>> "jms:queue:Queue2",
>>>>>>> "jms:queue:Queue3");
>>>>>>>
>>>>>>>
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>     
>>>>>         
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19901377.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by Jonathan Anstey <ja...@gmail.com>.
Since I can't reproduce your issue, would you mind doing up a test case 
and attaching it to a JIRA issue?  That will speed up the process of 
fixing this.

selezovikj wrote:
> I don't think that there is a problem with Camel, because when I try running
> my application with having my routes written in the Java DSL, WITHOUT using
> the multicast keyword, every queue of the static recipient list successfully
> receives the message. 
>
> The problem occurs, when I define the routing in Spring. 
> When I don't use the multicast keyword, only the first queue receives the
> message. 
> When I use the multicast keyword, none of the queue receives the message. 
>
> Errors: 
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.component.jms.RuntimeJmsException: Failed to extract body
> due to: javax.jms.JMSException: Failed to build body from bytes. Reason:
> java.io.IOException
>
> Caused by: javax.jms.JMSException: Failed to build body from bytes. Reason:
> java.io.IOException
>
>
>
> janstey wrote:
>   
>> Yeah, 1.5 hasn't been released yet so its still changing quite a bit. 
>> But this may be a bug in Camel 1.4.
>>
>> By the way, in my test I used the activemq component rather that the jms 
>> component to send to queues. So, something like this:
>>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>        xmlns:amq="http://activemq.apache.org/schema/core"
>>        xsi:schemaLocation="
>>        http://www.springframework.org/schema/beans 
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>        http://activemq.apache.org/camel/schema/spring 
>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
>>        http://activemq.apache.org/schema/core 
>> http://activemq.apache.org/schema/core/activemq-core.xsd">
>>
>>   <broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" 
>> persistent="false">
>>     <transportConnectors>
>>       <transportConnector uri="tcp://localhost:61616" />
>>     </transportConnectors>
>>   </broker>
>>
>>   <bean id="activemq" 
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>     <property name="brokerURL" value="tcp://localhost:61616"/>
>>   </bean>
>>
>>   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>     <package>org.apache.camel.testmulticast</package>
>>     <route>
>>       <from uri="activemq:tempqueue"/>
>>       <multicast>
>>         <to uri="activemq:personnel.records1"/>
>>         <to uri="activemq:personnel.records2"/>       
>>       </multicast>
>>     </route>   
>> ...
>>  
>>
>> selezovikj wrote:
>>     
>>> I am running ActiveMQ 5.1.0 and Camel 1.4.
>>> I thought that Camel 1.5 was not stable
>>>
>>>
>>> janstey wrote:
>>>   
>>>       
>>>> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT and 
>>>> all seems to work fine. Whats your JMS broker/version and Camel version?
>>>>
>>>> selezovikj wrote:
>>>>     
>>>>         
>>>>> I actually tested the Java DSL and it works without the "multicast"
>>>>> keyword. 
>>>>>
>>>>> In the camel DSL, without using the multicast keyword it only send to
>>>>> Queue1. 
>>>>> When I use the multicast keyword it does not send to any queues. 
>>>>> And it gives an error like: 
>>>>>
>>>>> Can't build body from bytes. 
>>>>>
>>>>> Error at
>>>>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>>>>
>>>>> Do you have any idea why is this so ? 
>>>>>
>>>>>
>>>>>
>>>>> janstey wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Actually, looks like the docs are a bit misleading. If you want the
>>>>>> same
>>>>>> message routed to all destinations, you'll need to wrap the outputs in
>>>>>> a
>>>>>> multicast element
>>>>>>
>>>>>> <route>
>>>>>>   <from uri="jms:numbers"/>
>>>>>>   <multicast>
>>>>>>     <to uri="jms:Queue1"/>
>>>>>>     <to uri="jms:Queue2"/>
>>>>>>     <to uri="jms:Queue3"/>
>>>>>>   </multicast>
>>>>>> </route>
>>>>>>
>>>>>> and also modify your Java DSL to
>>>>>>
>>>>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>>>>> "jms:queue:Queue2",
>>>>>> "jms:queue:Queue3");
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>
>>     
>
>   


Re: Camel Routing - Spring Configuration

Posted by selezovikj <se...@gmail.com>.
I don't think that there is a problem with Camel, because when I try running
my application with having my routes written in the Java DSL, WITHOUT using
the multicast keyword, every queue of the static recipient list successfully
receives the message. 

The problem occurs, when I define the routing in Spring. 
When I don't use the multicast keyword, only the first queue receives the
message. 
When I use the multicast keyword, none of the queue receives the message. 

Errors: 

org.apache.camel.RuntimeCamelException:
org.apache.camel.component.jms.RuntimeJmsException: Failed to extract body
due to: javax.jms.JMSException: Failed to build body from bytes. Reason:
java.io.IOException

Caused by: javax.jms.JMSException: Failed to build body from bytes. Reason:
java.io.IOException



janstey wrote:
> 
> Yeah, 1.5 hasn't been released yet so its still changing quite a bit. 
> But this may be a bug in Camel 1.4.
> 
> By the way, in my test I used the activemq component rather that the jms 
> component to send to queues. So, something like this:
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:amq="http://activemq.apache.org/schema/core"
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>        http://activemq.apache.org/camel/schema/spring 
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
>        http://activemq.apache.org/schema/core 
> http://activemq.apache.org/schema/core/activemq-core.xsd">
> 
>   <broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" 
> persistent="false">
>     <transportConnectors>
>       <transportConnector uri="tcp://localhost:61616" />
>     </transportConnectors>
>   </broker>
> 
>   <bean id="activemq" 
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>     <property name="brokerURL" value="tcp://localhost:61616"/>
>   </bean>
> 
>   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>     <package>org.apache.camel.testmulticast</package>
>     <route>
>       <from uri="activemq:tempqueue"/>
>       <multicast>
>         <to uri="activemq:personnel.records1"/>
>         <to uri="activemq:personnel.records2"/>       
>       </multicast>
>     </route>   
> ...
>  
> 
> selezovikj wrote:
>> I am running ActiveMQ 5.1.0 and Camel 1.4.
>> I thought that Camel 1.5 was not stable
>>
>>
>> janstey wrote:
>>   
>>> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT and 
>>> all seems to work fine. Whats your JMS broker/version and Camel version?
>>>
>>> selezovikj wrote:
>>>     
>>>> I actually tested the Java DSL and it works without the "multicast"
>>>> keyword. 
>>>>
>>>> In the camel DSL, without using the multicast keyword it only send to
>>>> Queue1. 
>>>> When I use the multicast keyword it does not send to any queues. 
>>>> And it gives an error like: 
>>>>
>>>> Can't build body from bytes. 
>>>>
>>>> Error at
>>>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>>>
>>>> Do you have any idea why is this so ? 
>>>>
>>>>
>>>>
>>>> janstey wrote:
>>>>   
>>>>       
>>>>> Actually, looks like the docs are a bit misleading. If you want the
>>>>> same
>>>>> message routed to all destinations, you'll need to wrap the outputs in
>>>>> a
>>>>> multicast element
>>>>>
>>>>> <route>
>>>>>   <from uri="jms:numbers"/>
>>>>>   <multicast>
>>>>>     <to uri="jms:Queue1"/>
>>>>>     <to uri="jms:Queue2"/>
>>>>>     <to uri="jms:Queue3"/>
>>>>>   </multicast>
>>>>> </route>
>>>>>
>>>>> and also modify your Java DSL to
>>>>>
>>>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>>>> "jms:queue:Queue2",
>>>>> "jms:queue:Queue3");
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19893952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by Jonathan Anstey <ja...@gmail.com>.
Yeah, 1.5 hasn't been released yet so its still changing quite a bit. 
But this may be a bug in Camel 1.4.

By the way, in my test I used the activemq component rather that the jms 
component to send to queues. So, something like this:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:amq="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
       http://activemq.apache.org/schema/core 
http://activemq.apache.org/schema/core/activemq-core.xsd">

  <broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" 
persistent="false">
    <transportConnectors>
      <transportConnector uri="tcp://localhost:61616" />
    </transportConnectors>
  </broker>

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

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <package>org.apache.camel.testmulticast</package>
    <route>
      <from uri="activemq:tempqueue"/>
      <multicast>
        <to uri="activemq:personnel.records1"/>
        <to uri="activemq:personnel.records2"/>       
      </multicast>
    </route>   
...
 

selezovikj wrote:
> I am running ActiveMQ 5.1.0 and Camel 1.4.
> I thought that Camel 1.5 was not stable
>
>
> janstey wrote:
>   
>> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT and 
>> all seems to work fine. Whats your JMS broker/version and Camel version?
>>
>> selezovikj wrote:
>>     
>>> I actually tested the Java DSL and it works without the "multicast"
>>> keyword. 
>>>
>>> In the camel DSL, without using the multicast keyword it only send to
>>> Queue1. 
>>> When I use the multicast keyword it does not send to any queues. 
>>> And it gives an error like: 
>>>
>>> Can't build body from bytes. 
>>>
>>> Error at
>>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>>
>>> Do you have any idea why is this so ? 
>>>
>>>
>>>
>>> janstey wrote:
>>>   
>>>       
>>>> Actually, looks like the docs are a bit misleading. If you want the same
>>>> message routed to all destinations, you'll need to wrap the outputs in a
>>>> multicast element
>>>>
>>>> <route>
>>>>   <from uri="jms:numbers"/>
>>>>   <multicast>
>>>>     <to uri="jms:Queue1"/>
>>>>     <to uri="jms:Queue2"/>
>>>>     <to uri="jms:Queue3"/>
>>>>   </multicast>
>>>> </route>
>>>>
>>>> and also modify your Java DSL to
>>>>
>>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>>> "jms:queue:Queue2",
>>>> "jms:queue:Queue3");
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>>
>>     
>
>   


Re: Camel Routing - Spring Configuration

Posted by selezovikj <se...@gmail.com>.
I am using ActiveMQ 5.1.0 and Camel 1.4.
I though that Camel 1.5 was not stable


janstey wrote:
> 
> I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT and 
> all seems to work fine. Whats your JMS broker/version and Camel version?
> 
> selezovikj wrote:
>> I actually tested the Java DSL and it works without the "multicast"
>> keyword. 
>>
>> In the camel DSL, without using the multicast keyword it only send to
>> Queue1. 
>> When I use the multicast keyword it does not send to any queues. 
>> And it gives an error like: 
>>
>> Can't build body from bytes. 
>>
>> Error at
>> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>>
>> Do you have any idea why is this so ? 
>>
>>
>>
>> janstey wrote:
>>   
>>> Actually, looks like the docs are a bit misleading. If you want the same
>>> message routed to all destinations, you'll need to wrap the outputs in a
>>> multicast element
>>>
>>> <route>
>>>   <from uri="jms:numbers"/>
>>>   <multicast>
>>>     <to uri="jms:Queue1"/>
>>>     <to uri="jms:Queue2"/>
>>>     <to uri="jms:Queue3"/>
>>>   </multicast>
>>> </route>
>>>
>>> and also modify your Java DSL to
>>>
>>> from("jms:numbers").multicast().to("jms:queue:Queue1",
>>> "jms:queue:Queue2",
>>> "jms:queue:Queue3");
>>>
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19881695.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by Jonathan Anstey <ja...@gmail.com>.
I was just running a test with ActiveMQ 5.1.0 and Camel 1.5-SNAPSHOT and 
all seems to work fine. Whats your JMS broker/version and Camel version?

selezovikj wrote:
> I actually tested the Java DSL and it works without the "multicast" keyword. 
>
> In the camel DSL, without using the multicast keyword it only send to
> Queue1. 
> When I use the multicast keyword it does not send to any queues. 
> And it gives an error like: 
>
> Can't build body from bytes. 
>
> Error at
> org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)
>
> Do you have any idea why is this so ? 
>
>
>
> janstey wrote:
>   
>> Actually, looks like the docs are a bit misleading. If you want the same
>> message routed to all destinations, you'll need to wrap the outputs in a
>> multicast element
>>
>> <route>
>>   <from uri="jms:numbers"/>
>>   <multicast>
>>     <to uri="jms:Queue1"/>
>>     <to uri="jms:Queue2"/>
>>     <to uri="jms:Queue3"/>
>>   </multicast>
>> </route>
>>
>> and also modify your Java DSL to
>>
>> from("jms:numbers").multicast().to("jms:queue:Queue1", "jms:queue:Queue2",
>> "jms:queue:Queue3");
>>
>>
>>     
>
>   


Re: Camel Routing - Spring Configuration

Posted by selezovikj <se...@gmail.com>.
I actually tested the Java DSL and it works without the "multicast" keyword. 

In the camel DSL, without using the multicast keyword it only send to
Queue1. 
When I use the multicast keyword it does not send to any queues. 
And it gives an error like: 

Can't build body from bytes. 

Error at
org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:97)

Do you have any idea why is this so ? 



janstey wrote:
> 
> Actually, looks like the docs are a bit misleading. If you want the same
> message routed to all destinations, you'll need to wrap the outputs in a
> multicast element
> 
> <route>
>   <from uri="jms:numbers"/>
>   <multicast>
>     <to uri="jms:Queue1"/>
>     <to uri="jms:Queue2"/>
>     <to uri="jms:Queue3"/>
>   </multicast>
> </route>
> 
> and also modify your Java DSL to
> 
> from("jms:numbers").multicast().to("jms:queue:Queue1", "jms:queue:Queue2",
> "jms:queue:Queue3");
> 
> 

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19880930.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by janstey <ja...@gmail.com>.
Actually, looks like the docs are a bit misleading. If you want the same
message routed to all destinations, you'll need to wrap the outputs in a
multicast element

<route>
  <from uri="jms:numbers"/>
  <multicast>
    <to uri="jms:Queue1"/>
    <to uri="jms:Queue2"/>
    <to uri="jms:Queue3"/>
  </multicast>
</route>

and also modify your Java DSL to

from("jms:numbers").multicast().to("jms:queue:Queue1", "jms:queue:Queue2",
"jms:queue:Queue3");

-- 
View this message in context: http://www.nabble.com/Camel-Routing---Spring-Configuration-tp19880117s22882p19880541.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Routing - Spring Configuration

Posted by Jonathan Anstey <ja...@gmail.com>.
You are doing a Static Recipient List 
(http://activemq.apache.org/camel/recipient-list.html) so your Spring 
DSL should look like:

  <route>
    <from uri="jms:numbers"/>
    <to uri="jms:Queue1"/>
    <to uri="jms:Queue2"/>
    <to uri="jms:Queue3"/>
  </route>

selezovikj wrote:
> I want to route a message from a queue "numbers" to three queues. I want all
> three queues to receive the very same message, so that later each queue can
> send the message to a corresponding bean. 
>  I did the route in Camel DSL. 
> My question is how would I configure the following route written in the
> Camel DSL to a route in Spring: 
>
> from("jms:numbers").to("jms:queue:Queue1", "jms:queue:Queue2",
> "jms:queue:Queue3");
> from("jms:queue:andysQueue3").to("bean:multiplier2");
> ------------------------------------------------------------------------------------------------------
> Possible Spring configurations: 
>
> 1:
> <camelContext id="camel"
> 		xmlns="http://activemq.apache.org/camel/schema/spring">
> 		<route>
> 			<from uri="jms:numbers"/>
> 			<to uri="jms:Queue1", "jms:Queue2", "jms:Queue3"/>
> 		</route>
> </camelContext>
>
> 2:
> <camelContext id="camel"
> 		xmlns="http://activemq.apache.org/camel/schema/spring">
> 		<route>
> 			<from uri="jms:numbers"/>
> 			<to uri="jms:Queue1"/>
> 		</route>
>                 <route>
> 			<from uri="jms:numbers"/>
> 			<to uri="jms:Queue2"/>
> 		</route>
>                 <route>
> 			<from uri="jms:numbers"/>
> 			<to uri="jms:Queue3"/>
> 		</route>
> </camelContext>
>
> 3: 
> Create three separate camelContexts, each one containing a route. 
>
>