You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by salemi <sa...@avaya.com> on 2013/08/08 20:25:30 UTC

Re: Incoming message from the queue need to be send to multiple consumer but keep the ordering

Hi,

I started to use message groups but camel throws the following exception.
What am I doing wrong?

013-08-08 12:15:35,030 [main           ] INFO  MainSupport                   
- Apache Camel 2.10.1 stopping
Exception in thread "main" 2013-08-08 12:15:35,047 [Thread-0       ] INFO 
MainSupport$HangupInterceptor  - Received hang up - stopping the main
instance.
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToStartRouteException: Failed to start route
operationalreceive2 because of Multiple consumers for the same endpoint is
not allowed: Endpoint[jms://queue:coperation]
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280)

The route is as followed
<route id="operationalsend" shutdownRunningTask="CompleteCurrentTaskOnly"
autoStartup="false">
    		<from
uri="file:target/classes?fileName=operational_msgs&amp;noop=true&amp;idempotent=false"/>
			<log message="Processing big file: ${header.CamelFileName}"/>
			<delay>
            	<constant>20000</constant>
            </delay>
			<split streaming="true">
				<tokenize token="\n"/>
				<unmarshal ref="cJSON"/>
				<process ref="jmsMessageGroupProcessor"/> 
                                
				<marshal ref="cJSON"/>
				<to uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
			</split>
			<log message="Done processing big file: ${header.CamelFileName}"/>
			<process ref="restartPuRouteProcessor"/>
			<delay>
                <constant>5000</constant>
            </delay>
    	</route>
        <route id="operationalreceive1"
shutdownRunningTask="CompleteCurrentTaskOnly" autoStartup="true">
             <from
uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
             <log message="${header.JMSXGroupID}"/>
        </route>    	
        <route id="operationalreceive2"
shutdownRunningTask="CompleteCurrentTaskOnly" autoStartup="true">
             <from
uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
             <log message="${header.JMSXGroupID}"/>
        </route>   



-----
Alireza Salemi
--
View this message in context: http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5737008.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incoming message from the queue need to be send to multiple consumer but keep the ordering

Posted by salemi <sa...@avaya.com>.
First of all many thank to you all for your suggestions, I was available to
come up with an scalable solution and our chief architect even accepted
thesolution. I can ask the JMS producers to add the JMSXGroupID header as
well as an additional header to use as an selector.

As Claus suggested we will use the JMSXGroupID header and will deploy
multiple consumers. To avoid the time spent in the splitter I decided to
remove the choice and use JMS selectors instead (see below).

<route id="1">
<from
uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}?concurrentConsumers=2&
amp;selector=MessageType='x1'" />
...
<route id="2">
<from
uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}?concurrentConsumers=2&amp;selector=MessageType='x2'"
/>
..

The only concern remains how ActiveMq performs since I am combining
selectors and group.

So far I have seen almost linear scalability by adding a new consumer. I
have done testing with 11 concurrent consumer which is enough for our
purposes.



-----
Alireza Salemi
--
View this message in context: http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5737226.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incoming message from the queue need to be send to multiple consumer but keep the ordering

Posted by salemi <sa...@avaya.com>.
when use ?multipleConsumers=true in the
uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}?multipleConsumers=true"
I get the error that it doesn't know the property.

Or do I have to use that somewhere else?



-----
Alireza Salemi
--
View this message in context: http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5737025.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incoming message from the queue need to be send to multiple consumer but keep the ordering

Posted by Claus Ibsen <cl...@gmail.com>.
You have 2 routes with the same uri, which is not allowed by default.
You can set ?multipleConsumers=true to override that.

If you are using queues then usually just one route and then use
concurrentConsumers=X to have parallel processing.



On Thu, Aug 8, 2013 at 8:25 PM, salemi <sa...@avaya.com> wrote:
> Hi,
>
> I started to use message groups but camel throws the following exception.
> What am I doing wrong?
>
> 013-08-08 12:15:35,030 [main           ] INFO  MainSupport
> - Apache Camel 2.10.1 stopping
> Exception in thread "main" 2013-08-08 12:15:35,047 [Thread-0       ] INFO
> MainSupport$HangupInterceptor  - Received hang up - stopping the main
> instance.
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToStartRouteException: Failed to start route
> operationalreceive2 because of Multiple consumers for the same endpoint is
> not allowed: Endpoint[jms://queue:coperation]
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280)
>
> The route is as followed
> <route id="operationalsend" shutdownRunningTask="CompleteCurrentTaskOnly"
> autoStartup="false">
>                 <from
> uri="file:target/classes?fileName=operational_msgs&amp;noop=true&amp;idempotent=false"/>
>                         <log message="Processing big file: ${header.CamelFileName}"/>
>                         <delay>
>                 <constant>20000</constant>
>             </delay>
>                         <split streaming="true">
>                                 <tokenize token="\n"/>
>                                 <unmarshal ref="cJSON"/>
>                                 <process ref="jmsMessageGroupProcessor"/>
>
>                                 <marshal ref="cJSON"/>
>                                 <to uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
>                         </split>
>                         <log message="Done processing big file: ${header.CamelFileName}"/>
>                         <process ref="restartPuRouteProcessor"/>
>                         <delay>
>                 <constant>5000</constant>
>             </delay>
>         </route>
>         <route id="operationalreceive1"
> shutdownRunningTask="CompleteCurrentTaskOnly" autoStartup="true">
>              <from
> uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
>              <log message="${header.JMSXGroupID}"/>
>         </route>
>         <route id="operationalreceive2"
> shutdownRunningTask="CompleteCurrentTaskOnly" autoStartup="true">
>              <from
> uri="{{operational.topic.prefix}}.{{source.type}}.{{source.name}}"/>
>              <log message="${header.JMSXGroupID}"/>
>         </route>
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context: http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5737008.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen