You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mond Ray Mond <op...@gmail.com> on 2010/02/10 13:51:59 UTC

how to configure sending to MQseries

In Spring I have the following queue defined:

    <!-- targetClient is used to tell the MQ system that the target is MQ
(1) not JMS (0) -->
    <bean id="pocBridge.imqOutgoingQueue" class="com.ibm.mq.jms.MQQueue"
p:targetClient="1">
        <constructor-arg value="MQSD"/>
        <constructor-arg value="TQS.QLOC.RECEIVE.HEAD.O.AMQD1"/>
    </bean>

All of these arguments / properties are needed to make the queue work.  How
do I tell Camel to use this queue reference or how can I configure this
queue in Camel DSL?

I assumed that the JMS component would have some option to set some
properties on the implementation but I can't see how to do that.

Any help would be appreciated.

Best regards

Ray 
-- 
View this message in context: http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27530729.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help converting a Spring queue definition to a Camel endpoint

Posted by nakshathri <ma...@happiestminds.com>.
Hello Ray, Thanks for this. I think it will save lots of my time. But one
small information i need. Why do we need jetty configuration file? Can you
please explain. Regards, Manjunath



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-configure-sending-to-MQseries-tp478478p5728222.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help converting a Spring queue definition to a Camel endpoint

Posted by Mond Raymond <mo...@gmail.com>.
I have this all working nice now:

In the Camel Spring context file:

    <bean id="jmsDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"/>

    <jee:jndi-lookup id="mqSeriesBaseConnectionFactory"
jndi-name="jms/mqseries"/>

    <bean id="mqSeriesConnectionFactory"
         
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"
          p:username="${user}"
          p:password="${password}"
          p:targetConnectionFactory-ref="mqSeriesBaseConnectionFactory"/>

    <bean id="mqseries" class="org.apache.camel.component.jms.JmsComponent"
          p:connectionFactory-ref="mqSeriesConnectionFactory"
          p:useVersion102="true"
          p:recoveryInterval="30000"
          p:testConnectionOnStartup="true"
          p:destinationResolver-ref="jmsDestinationResolver"/>

    <bean id="someRoute" class="com.blah.SomeRoute"
          p:fromURI="mqseries:mqseriesInQueue"
          p:toURI="mqseries:mqseriesOutQueue"/>

    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="someRoute"/>
    </camelContext>

In the Jetty configuration file:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">

    <Array id="plusConfig" type="java.lang.String">
        <Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
        <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
        <Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
    </Array>

    <New id="plus" class="org.mortbay.jetty.webapp.WebAppContext">
        <Set name="ConfigurationClasses">
            <Ref id="plusConfig"/>
        </Set>
    </New>

    <New id="mqConnectionFactory"
class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>jms/mqseries</Arg>
        <Arg>
            <New class="com.ibm.mq.jms.MQQueueConnectionFactory">
                <Set name="HostName">HOST</Set>
                <Set name="Port">NNNN</Set>
                <Set name="Channel">CHANNEL</Set>
                <Set name="TransportType">1</Set>
                <Set name="QueueManager">QM</Set>
            </New>
        </Arg>
    </New>
    <New id="mqIncomingQueue"
class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>mqseriesInQueue</Arg>
        <Arg>
            <New class="com.ibm.mq.jms.MQQueue">
                <Arg>CHANNEL</Arg>
                <Arg>IN_QNAME</Arg>
            </New>
        </Arg>
    </New>
    <New id="mqOutgoingQueue"
class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>mqseriesOutQueue</Arg>
        <Arg>
            <New class="com.ibm.mq.jms.MQQueue">
                <Arg>CHANNEL</Arg>
                <Arg>OUT_QNAME</Arg>
                <Set name="targetClient">1</Set>
            </New>
        </Arg>
    </New>
</Configure>

I hope this helps others as I lost a lot of time on this small detail.

Best regards

Ray
-- 
View this message in context: http://camel.465427.n5.nabble.com/how-to-configure-sending-to-MQseries-tp478478p2834937.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help converting a Spring queue definition to a Camel endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
You can use the destinationResolver option on the JMS endpoint to
implement a resolver that can lookup your custom MQ queue object.
http://camel.apache.org/jms.html

Which has a section about it and a link to this post
http://old.nabble.com/JMS-queue---JNDI-instead-of-physical-name-td24484994.html

On Thu, Feb 11, 2010 at 9:47 AM, Mond Ray Mond <op...@gmail.com> wrote:
>
> Thanks Christian.
>
> I have used those links already and checked again but they are limited in
> their use of properties and constructor arguments.
>
> I have it all working in Spring as I am allowed to control these aspects on
> the class.  I cannot see an equivalent mechanism to provide the same degree
> of control on a Camel endpoint.
>
> So it's not really a MQSeries question (despite my subject line) but rather
> a question of how to configure Camel in an equivalent fashion to Spring.
>
> Your response has helped me to clarify this so I have changed the subject to
> reflect this aspect.
>
> Best regards
>
> Ray
>
>
>
> Christian Mueller wrote:
>>
>> Hey Ray!
>>
>> May be this link is helpful:
>> http://old.nabble.com/Camel-and-IBM-MQ-Series-td24524277.html
>>
>> Regards,
>> Christian
>>
>> On Wed, Feb 10, 2010 at 1:51 PM, Mond Ray Mond <op...@gmail.com>
>> wrote:
>>
>>>
>>> In Spring I have the following queue defined:
>>>
>>>    <!-- targetClient is used to tell the MQ system that the target is MQ
>>> (1) not JMS (0) -->
>>>    <bean id="pocBridge.imqOutgoingQueue" class="com.ibm.mq.jms.MQQueue"
>>> p:targetClient="1">
>>>        <constructor-arg value="MQSD"/>
>>>        <constructor-arg value="TQS.QLOC.RECEIVE.HEAD.O.AMQD1"/>
>>>    </bean>
>>>
>>> All of these arguments / properties are needed to make the queue work.
>>> How
>>> do I tell Camel to use this queue reference or how can I configure this
>>> queue in Camel DSL?
>>>
>>> I assumed that the JMS component would have some option to set some
>>> properties on the implementation but I can't see how to do that.
>>>
>>> Any help would be appreciated.
>>>
>>> Best regards
>>>
>>> Ray
>>> --
>>> View this message in context:
>>> http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27530729.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27543967.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

Need help converting a Spring queue definition to a Camel endpoint

Posted by Mond Ray Mond <op...@gmail.com>.
Thanks Christian.

I have used those links already and checked again but they are limited in
their use of properties and constructor arguments.

I have it all working in Spring as I am allowed to control these aspects on
the class.  I cannot see an equivalent mechanism to provide the same degree
of control on a Camel endpoint.

So it's not really a MQSeries question (despite my subject line) but rather
a question of how to configure Camel in an equivalent fashion to Spring.

Your response has helped me to clarify this so I have changed the subject to
reflect this aspect.

Best regards

Ray



Christian Mueller wrote:
> 
> Hey Ray!
> 
> May be this link is helpful:
> http://old.nabble.com/Camel-and-IBM-MQ-Series-td24524277.html
> 
> Regards,
> Christian
> 
> On Wed, Feb 10, 2010 at 1:51 PM, Mond Ray Mond <op...@gmail.com>
> wrote:
> 
>>
>> In Spring I have the following queue defined:
>>
>>    <!-- targetClient is used to tell the MQ system that the target is MQ
>> (1) not JMS (0) -->
>>    <bean id="pocBridge.imqOutgoingQueue" class="com.ibm.mq.jms.MQQueue"
>> p:targetClient="1">
>>        <constructor-arg value="MQSD"/>
>>        <constructor-arg value="TQS.QLOC.RECEIVE.HEAD.O.AMQD1"/>
>>    </bean>
>>
>> All of these arguments / properties are needed to make the queue work. 
>> How
>> do I tell Camel to use this queue reference or how can I configure this
>> queue in Camel DSL?
>>
>> I assumed that the JMS component would have some option to set some
>> properties on the implementation but I can't see how to do that.
>>
>> Any help would be appreciated.
>>
>> Best regards
>>
>> Ray
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27530729.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27543967.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: how to configure sending to MQseries

Posted by Christian Müller <ch...@gmail.com>.
Hey Ray!

May be this link is helpful:
http://old.nabble.com/Camel-and-IBM-MQ-Series-td24524277.html

Regards,
Christian

On Wed, Feb 10, 2010 at 1:51 PM, Mond Ray Mond <op...@gmail.com> wrote:

>
> In Spring I have the following queue defined:
>
>    <!-- targetClient is used to tell the MQ system that the target is MQ
> (1) not JMS (0) -->
>    <bean id="pocBridge.imqOutgoingQueue" class="com.ibm.mq.jms.MQQueue"
> p:targetClient="1">
>        <constructor-arg value="MQSD"/>
>        <constructor-arg value="TQS.QLOC.RECEIVE.HEAD.O.AMQD1"/>
>    </bean>
>
> All of these arguments / properties are needed to make the queue work.  How
> do I tell Camel to use this queue reference or how can I configure this
> queue in Camel DSL?
>
> I assumed that the JMS component would have some option to set some
> properties on the implementation but I can't see how to do that.
>
> Any help would be appreciated.
>
> Best regards
>
> Ray
> --
> View this message in context:
> http://old.nabble.com/how-to-configure-sending-to-MQseries-tp27530729p27530729.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>