You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by waterback <ma...@innoq.com> on 2010/11/11 13:45:06 UTC

Connect with WebSphere MQ / Single Consumer allowed

Hi All,

i work with Camel 2.2 and connect to WebSphere MQ for Queue Consumers.
My Problem is, that the Queue on WMQ the route is trying to connect to is
configured for a single consumer only.
When a second consumer tries to connect, i get the respective
queue-connection error from WebSphere MQ.
When route 2 is started directly (without the .noAutoStartup() in the test
it throws a real exception: 
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToStartRouteException: Failed to start route 2
because of Multiple consumers for the same endpoint is not allowed:
Endpoint[ibmmq://queue:IN?cacheLevelName=CACHE_NONE&testConnectionOnStartup=true]

 If i use the configuration like shown below (with .noAutoStartup() ) and i
start the route later on in the test, the route tries to connect to mq
forever and is in a real "zombie" state, because it declares itself started
but cannot get to do anything. 
What i would need is, that the route stops at some point and say: i can't
like it does when it is started with the camelcontext. 

Does someone have a hint how to achieve this? (I know that activemq has that
nice "maxReconnectAttempts" -thing that AFAIK i can't use with the standard
jms-component.


Here's some code:
My route starts with: (rest is obmitted because it's irrelevant - it's just
a test)
from("ibmmq:queue:DEB.VSL.ZIFS.IN.ARE?testConnectionOnStartup=true&cacheLevelName=CACHE_NONE")
            .routeId("1")
            .process( bla bla bla);

       
from("ibmmq:queue:DEB.VSL.ZIFS.IN.ARE?testConnectionOnStartup=true&cacheLevelName=CACHE_NONE")
            .routeId("2")
            .noAutoStartup()
            .process( bla bla bla);

spring looks like this:
<bean id="ibmmq"
		class="org.apache.camel.component.jms.JmsComponent">
			<property name="connectionFactory">
				<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
					<property name="transportType">
						<util:constant
static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ" />
					</property>
					<property name="queuemanager" value="MQMGR1" />
					<property name="hostName" value="localhost" />
					<property name="port" value="1414" />
					<property name="channel" value="CHL" />
				</bean>
			</property>
		</bean>

When i'm trying to start route "2", there is also a "1" that is started
directly and gets the consumer "pole position"  

Any help would be greatly appreciated!

Thanx in advance,
martin


-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3260184.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by waterback <ma...@innoq.com>.
Well... 
YES... 


Now i have an argument to convince my Project-Manager that the Migration
from 2.2->2.5 is
absolutely necessary...

Once again: Thanx
 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261804.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 12, 2010 at 10:56 AM, waterback <ma...@innoq.com> wrote:
>
> Get your point...
>
> i'll try that, hopefully it works, because i read in other posts / forums
> that exception listeners are not supported in j2ee-Servers (or at least in
> WebSphere AS)
>
> Hopefully i'm not offensive saying that the Camel-Point of view seems to be
> differing (with the same exception) when the route is started right away
> with the context. I only get the problem when the route is configured
> .noAutoStartup() and started eventually.
>

You may want to try Camel 2.5 as we did some changes on startup when
having noAutoStartup enabled.


> Anyway: Thank you very much for your time... and for that great Book!
>
> Martin
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261737.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by waterback <ma...@innoq.com>.
Get your point... 

i'll try that, hopefully it works, because i read in other posts / forums
that exception listeners are not supported in j2ee-Servers (or at least in
WebSphere AS)

Hopefully i'm not offensive saying that the Camel-Point of view seems to be
differing (with the same exception) when the route is started right away
with the context. I only get the problem when the route is configured
.noAutoStartup() and started eventually. 

Anyway: Thank you very much for your time... and for that great Book!

Martin

-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261737.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 12, 2010 at 10:22 AM, waterback <ma...@innoq.com> wrote:
>
>
> Claus Ibsen-2 wrote:
>>
>> Okay I checked the source
>>
> Thank you...
>
> Do you have any other idea then, how to control that the route that tries to
> connect and is denied by WMQ
> is either stopped right away or at least that i could see that it is not
> really started, although it declares itself started, when you ask
> CamelContext with getRouteStatus(..)
>

>From Camel point of view the route was started because the start
operation succeeded.

You most likely need to use an exception listener on the JMS
endpoint/component to catch those exceptions from IBM WebSphere.


>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261686.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by waterback <ma...@innoq.com>.

Claus Ibsen-2 wrote:
> 
> Okay I checked the source
> 
Thank you...

Do you have any other idea then, how to control that the route that tries to
connect and is denied by WMQ 
is either stopped right away or at least that i could see that it is not
really started, although it declares itself started, when you ask
CamelContext with getRouteStatus(..)






-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261686.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by Claus Ibsen <cl...@gmail.com>.
Okay I checked the source

Some endpoints leverages the MultipleConsumersSupport interface which
controls if you can have 2+ routes with the same from(xxx) endpoint.
And the JMS endpoint only allows that for topics, because that's whats
makes sense.

And therefore the multipleConsumers option cannot be set on JMS.



On Fri, Nov 12, 2010 at 10:04 AM, waterback <ma...@innoq.com> wrote:
>
> Well i did: That's what it says...
>
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
> resolve endpoint:
> ibmmq://queue:DEB.VSL.ZIFS.IN.ARE?cacheLevelName=CACHE_NONE&multipleConsumers=true&testConnectionOnStartup=true
> due to: There are 1 parameters that couldn't be set on the endpoint. Check
> the uri if the parameters are spelt correctly and that they are properties
> of the endpoint. Unknown parameters=[{multipleConsumers=true}]
>
> i'm using Camel 2.2 - maybe i'm missing sth?
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261656.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by waterback <ma...@innoq.com>.
Well i did: That's what it says... 

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint:
ibmmq://queue:DEB.VSL.ZIFS.IN.ARE?cacheLevelName=CACHE_NONE&multipleConsumers=true&testConnectionOnStartup=true
due to: There are 1 parameters that couldn't be set on the endpoint. Check
the uri if the parameters are spelt correctly and that they are properties
of the endpoint. Unknown parameters=[{multipleConsumers=true}]

i'm using Camel 2.2 - maybe i'm missing sth?
-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261656.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 12, 2010 at 9:12 AM, waterback <ma...@innoq.com> wrote:
>
> Hi Claus,
>
> maybe i didn't make myself clear enough...
> The WMQ-Queue is rightfully configured for single-consumer only (this is
> done in WebSphere MQ Message Broker), there should be only one consumer at
> any time....
>
> My Camel-App is destined to be installed in a WebSphere-Cluster (with 2
> servers).
> With some trick i'll try to make sure that the route that consumes from this
> queue is at least and at most started on one of both servers only.
>
> I understand what you suggest with "multipleconsumers=true", but where
> should i put it, because the jms-component doesn't allow this argument?
>

On the endpoint as it ought to support it. At least try it out first.

> btw: Thanx...
>
> Martin
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261601.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Connect with WebSphere MQ / Single Consumer allowed

Posted by waterback <ma...@innoq.com>.
Hi Claus,

maybe i didn't make myself clear enough... 
The WMQ-Queue is rightfully configured for single-consumer only (this is
done in WebSphere MQ Message Broker), there should be only one consumer at
any time....

My Camel-App is destined to be installed in a WebSphere-Cluster (with 2
servers). 
With some trick i'll try to make sure that the route that consumes from this
queue is at least and at most started on one of both servers only.

I understand what you suggest with "multipleconsumers=true", but where
should i put it, because the jms-component doesn't allow this argument?

btw: Thanx...

Martin

-- 
View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3261601.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connect with WebSphere MQ / Single Consumer allowed

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

I think you can maybe tell Camel to allow multipleConsumers=true on
those ibmjms endpoints.



On Thu, Nov 11, 2010 at 1:45 PM, waterback <ma...@innoq.com> wrote:
>
> Hi All,
>
> i work with Camel 2.2 and connect to WebSphere MQ for Queue Consumers.
> My Problem is, that the Queue on WMQ the route is trying to connect to is
> configured for a single consumer only.
> When a second consumer tries to connect, i get the respective
> queue-connection error from WebSphere MQ.
> When route 2 is started directly (without the .noAutoStartup() in the test
> it throws a real exception:
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToStartRouteException: Failed to start route 2
> because of Multiple consumers for the same endpoint is not allowed:
> Endpoint[ibmmq://queue:IN?cacheLevelName=CACHE_NONE&testConnectionOnStartup=true]
>
>  If i use the configuration like shown below (with .noAutoStartup() ) and i
> start the route later on in the test, the route tries to connect to mq
> forever and is in a real "zombie" state, because it declares itself started
> but cannot get to do anything.
> What i would need is, that the route stops at some point and say: i can't
> like it does when it is started with the camelcontext.
>
> Does someone have a hint how to achieve this? (I know that activemq has that
> nice "maxReconnectAttempts" -thing that AFAIK i can't use with the standard
> jms-component.
>
>
> Here's some code:
> My route starts with: (rest is obmitted because it's irrelevant - it's just
> a test)
> from("ibmmq:queue:DEB.VSL.ZIFS.IN.ARE?testConnectionOnStartup=true&cacheLevelName=CACHE_NONE")
>            .routeId("1")
>            .process( bla bla bla);
>
>
> from("ibmmq:queue:DEB.VSL.ZIFS.IN.ARE?testConnectionOnStartup=true&cacheLevelName=CACHE_NONE")
>            .routeId("2")
>            .noAutoStartup()
>            .process( bla bla bla);
>
> spring looks like this:
> <bean id="ibmmq"
>                class="org.apache.camel.component.jms.JmsComponent">
>                        <property name="connectionFactory">
>                                <bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
>                                        <property name="transportType">
>                                                <util:constant
> static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ" />
>                                        </property>
>                                        <property name="queuemanager" value="MQMGR1" />
>                                        <property name="hostName" value="localhost" />
>                                        <property name="port" value="1414" />
>                                        <property name="channel" value="CHL" />
>                                </bean>
>                        </property>
>                </bean>
>
> When i'm trying to start route "2", there is also a "1" that is started
> directly and gets the consumer "pole position"
>
> Any help would be greatly appreciated!
>
> Thanx in advance,
> martin
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connect-with-WebSphere-MQ-Single-Consumer-allowed-tp3260184p3260184.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/