You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com> on 2015/12/09 00:21:08 UTC

WMQ + CamelBlueprintTestSupport

Hello,

I was able to successfully configure Apache Camel 2.12 to listen to a WMQ
queue.  I am able to deploy it into Fuse 6.1 successfully and I get
messages.  I am trying to create some CamelBlueprintTestSupport tests and I
run into the following error:

Failed to create route .. because of Failed to resolve endpoint: ibmmq: ..

I have two XML files within the OSGI-INF/blueprint directory, namely
queue-route.xml and wmq-config.xml as follows:

queue-route.xml :
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
   
	<camelContext id="wmqContext" trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
         <route id="config-wmq">
            <from uri="ibmmq:X"/>
            <to uri="direct-vm:logger"/>
        </route>
	</camelContext>
</blueprint>

wmq-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
	xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
       
    <cm:property-placeholder id="placeholder" persistent-id="QueueConfig"/>
    
	<bean id="connectionFactoryConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
		<property name="connectionFactory" ref="secureConnectionFactory" />
		<property name="concurrentConsumers" value="${concurrentConsumers}" />
		<property name="maxConcurrentConsumers" value="${maxConcurrentConsumers}"
/>
		<property name="maxMessagesPerTask" value="${maxMessagesPerTask}" />
		<property name="receiveTimeout" value="${receiveTimeout}" />
		<property name="idleConsumerLimit" value="${idleConsumerLimit}" />
	</bean>

	
	<bean id="mqConnectionFactory"
class="com.ibm.mq.jms.MQQueueConnectionFactory">
		<property name="hostName" value="${hostName}" />
		<property name="port" value="${port}" />
		<property name="queueManager" value="${queueManager}" />
		<property name="channel" value="${channel}"/>
  		<property name="transportType" value="${transportType}"/>
	</bean>

	<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
		<property name="configuration" ref="connectionFactoryConfig" />
	</bean>

	<bean id="secureConnectionFactory"
	
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
		<property name="targetConnectionFactory" ref="mqConnectionFactory" />
		<property name="username" value="${username}"/>
		<property name="password" value="${password}"/>
	</bean>
</blueprint>

As you will note, the ibmmq is defined (and it in fact works perfectly in
Fuse 6.1)

In my test case, I return the two XML files from the
getBlueprintDescriptor() as follows:

	@Override
	protected String getBlueprintDescriptor() {
		return
"OSGI-INF/blueprint/queue-route.xml,OSGI-INF/blueprint/wmq-config.xml";
	}

But my test cases that extends CamelBlueprintTestSupport does not recognize
the 'ibmmq' component.  I know that we can use context.addComponent()
method, but I am not sure how I would do that (or IF I should do that). 
What could I be doing wrong?  Any help will be greatly appreciated.

Thank You,
Sunil




--
View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: WMQ + CamelBlueprintTestSupport

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Sunil -

I asked about the property placeholders because there were a lot of issues with CamelBlueprintTestSupport, property placeholders and synchronization.  I think these issues have been resolved in the later versions of Camel.

Is it possible to test the route using Camel 2.16.1 to see if you’re hitting one of the issues that has been corrected?


Also - earlier in the thread you mentioned something about using context.addComponent to register the “ibmmq” component.  I think you could provide that component by overriding the addServicesOnStartup method of CamelBlueprintTestSupport.

 - Quinn



> On Jan 26, 2016, at 6:17 PM, web_nabble@sunilsamuel.com wrote:
> 
> Hi Quinn,
> 
> Sorry I did not see this comment.  I configure the /etc folder within JBoss
> Fuse to provide this information.  That part is working fine though.
> 
> Thanks,
> Sunil.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5776758.html
> Sent from the Camel Development mailing list archive at Nabble.com.


Re: WMQ + CamelBlueprintTestSupport

Posted by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com>.
Hi Quinn,

Sorry I did not see this comment.  I configure the /etc folder within JBoss
Fuse to provide this information.  That part is working fine though.

Thanks,
Sunil.



--
View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5776758.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: WMQ + CamelBlueprintTestSupport

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
I noticed you are using Blueprint Property Placeholders, but you haven’t specified any default values.

<cm:property-placeholder id="placeholder" persistent-id="QueueConfig”/>

How are you providing the properties?

Quinn Stevenson



> On Dec 23, 2015, at 5:13 AM, web_nabble@sunilsamuel.com wrote:
> 
> Hello,
> 
> Thank you for the response.  I tried this already and it did not work.  I
> will continue to work on this to see if I can figure out what the issue is
> and will post if/once I solve this issue in case others run into the same
> issue.
> 
> Thank You,
> sunil.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5775400.html
> Sent from the Camel Development mailing list archive at Nabble.com.


Re: WMQ + CamelBlueprintTestSupport

Posted by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com>.
Hello,

Thank you for the response.  I tried this already and it did not work.  I
will continue to work on this to see if I can figure out what the issue is
and will post if/once I solve this issue in case others run into the same
issue.

Thank You,
sunil.



--
View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5775400.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: WMQ + CamelBlueprintTestSupport

Posted by Claus Ibsen <cl...@gmail.com>.
Try loading the xml files in the reverse order so the xml with the
ibmmq bean is loaded first

On Wed, Dec 9, 2015 at 12:21 AM, web_nabble@sunilsamuel.com
<we...@sunilsamuel.com> wrote:
> Hello,
>
> I was able to successfully configure Apache Camel 2.12 to listen to a WMQ
> queue.  I am able to deploy it into Fuse 6.1 successfully and I get
> messages.  I am trying to create some CamelBlueprintTestSupport tests and I
> run into the following error:
>
> Failed to create route .. because of Failed to resolve endpoint: ibmmq: ..
>
> I have two XML files within the OSGI-INF/blueprint directory, namely
> queue-route.xml and wmq-config.xml as follows:
>
> queue-route.xml :
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
>        xsi:schemaLocation="
>        http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>        http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
>
>         <camelContext id="wmqContext" trace="false"
> xmlns="http://camel.apache.org/schema/blueprint">
>          <route id="config-wmq">
>             <from uri="ibmmq:X"/>
>             <to uri="direct-vm:logger"/>
>         </route>
>         </camelContext>
> </blueprint>
>
> wmq-config.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
>         xsi:schemaLocation="
>        http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>        http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
>
>     <cm:property-placeholder id="placeholder" persistent-id="QueueConfig"/>
>
>         <bean id="connectionFactoryConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>                 <property name="connectionFactory" ref="secureConnectionFactory" />
>                 <property name="concurrentConsumers" value="${concurrentConsumers}" />
>                 <property name="maxConcurrentConsumers" value="${maxConcurrentConsumers}"
> />
>                 <property name="maxMessagesPerTask" value="${maxMessagesPerTask}" />
>                 <property name="receiveTimeout" value="${receiveTimeout}" />
>                 <property name="idleConsumerLimit" value="${idleConsumerLimit}" />
>         </bean>
>
>
>         <bean id="mqConnectionFactory"
> class="com.ibm.mq.jms.MQQueueConnectionFactory">
>                 <property name="hostName" value="${hostName}" />
>                 <property name="port" value="${port}" />
>                 <property name="queueManager" value="${queueManager}" />
>                 <property name="channel" value="${channel}"/>
>                 <property name="transportType" value="${transportType}"/>
>         </bean>
>
>         <bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
>                 <property name="configuration" ref="connectionFactoryConfig" />
>         </bean>
>
>         <bean id="secureConnectionFactory"
>
> class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>                 <property name="targetConnectionFactory" ref="mqConnectionFactory" />
>                 <property name="username" value="${username}"/>
>                 <property name="password" value="${password}"/>
>         </bean>
> </blueprint>
>
> As you will note, the ibmmq is defined (and it in fact works perfectly in
> Fuse 6.1)
>
> In my test case, I return the two XML files from the
> getBlueprintDescriptor() as follows:
>
>         @Override
>         protected String getBlueprintDescriptor() {
>                 return
> "OSGI-INF/blueprint/queue-route.xml,OSGI-INF/blueprint/wmq-config.xml";
>         }
>
> But my test cases that extends CamelBlueprintTestSupport does not recognize
> the 'ibmmq' component.  I know that we can use context.addComponent()
> method, but I am not sure how I would do that (or IF I should do that).
> What could I be doing wrong?  Any help will be greatly appreciated.
>
> Thank You,
> Sunil
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2