You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by johper <ka...@hotmail.com> on 2006/09/01 09:50:14 UTC

RE: JMS sample consumer/provider with JBossMQ

Hello Sufyan, thanks for you reply and sample code. If I only could get it to
work :-) !
I have been struggling with "xbean deployment" and the "servicemix-jms"
component and build a service assemby with Maven.
Do you deploy your sample all in one "servicemix.xml" file or do you wrap it
in a "service assembly" ? Maybe it is my packaging that is wrong??
/johan


Sufyan Arif wrote:
> 
> Hi,
> 
> We are also using jboss mq both to consume and deliver messages from
> within servicemix. We used Spring to set up the connection factory
> needed to communicate with the jms provider. I have included the
> configuration that we use.
> 
> Thanks
> Sufyan
> 
>   <sm:activationSpec id="jmsConsumers">
>       <sm:component>
>         <jms:component>
>         <jms:endpoints>
>           <jms:endpoint service="rdf:jmsConsumer"
>                              endpoint="jmsConsumer"
>                              targetService="rdf:router"
>                              role="consumer"
>  
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>                              destinationStyle="queue"
>                              destination="#esbDestination"
>  
> connectionFactory="#jmsQueueConnectionFactory" />
> 
>                <jms:endpoint service="rdf:mortgageApplicationConsumer"
>                         endpoint="mortgageApplicationConsumer"
>                             targetService="rdf:router"
>                              role="consumer"
>  
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>                              destinationStyle="queue"
>  
> destination="#mortgageApplicationDestination"
>  
> connectionFactory="#jmsQueueConnectionFactory" />
> 
>                   </jms:endpoints>
>            </jms:component>
>      </sm:component>
>   </sm:activationSpec>
> 
> 
>   <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
>       <property name="environment">
>           <props>
>               <prop
> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactor
> y</prop>
>               <prop key="java.naming.provider.url">localhost:1099</prop>
>               <prop
> key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</
> prop>
>           </props>
>       </property>
>   </bean>
> 
>   <bean id="jmsQueueConnectionFactory"
>           class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>         <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>UIL2ConnectionFactory</value>
>       </property>
>   </bean>
> 
>   <!-- Queue used for delaying sending of the mortgage application -->
>   <bean id="mortgageApplicationDestination"
>         class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>           <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>queue/mortgageApplicationQueue</value>
>       </property>
>   </bean>
> 
>   <!-- Entry point into the esb for async comms -->
>   <bean id="esbDestination"
>         class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>           <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>queue/esbQueue</value>
>       </property>
>   </bean>
> 
>   <bean id="jmsTemplate"
>           class="org.springframework.jms.core.JmsTemplate">
>       <property name="connectionFactory">
>           <ref bean="jmsQueueConnectionFactory"/>
>       </property>
>       <property name="defaultDestination">
>           <ref bean="mortgageApplicationDestination"/>
>       </property>
>       <property name="receiveTimeout">
>           <value>30000</value>
>       </property>
>   </bean>
> 
> 
> -----Original Message-----
> From: johper [mailto:karljpersson@hotmail.com] 
> Sent: 31 August 2006 14:10
> To: servicemix-users@geronimo.apache.org
> Subject: JMS sample consumer/provider with JBossMQ
> 
> 
> Hi,
> Been trying all kind of snippets from around this forum and internet.
> With
> no luck :-(
> 
> I built SM-SAR yesterday and deployed SM-SAR into JBoss. Everything
> works
> fine. ActiveMQ whitin SM works fine, JBossMQ within Jboss works fine
> (having
> MDB's etc etc.
> Now I would like SM to receive and send messages to/from JBossMQ.
> 
> When using SM-SAR and JBoss they sit in the same VM, should local or
> remote
> JNDI names be used (seen both in samples) ? 
> 
> Please point in some direction or post at complete working sample. We
> really
> need to integrate SM and Jboss asap.
> 
> tia-jp
> -- 
> View this message in context:
> http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf219662
> 1.html#a6079036
> Sent from the ServiceMix - User forum at Nabble.com.
> 
> 
> This transmission is confidential and intended solely for the person or
> organisation to whom it is addressed. It may contain privileged and
> confidential information. If you are not the intended recipient, you
> should not copy, distribute or take any action in reliance on it. If you
> have received this transmission in error, please notify the sender
> immediately. Any opinions or advice contained in this e-mail are those of
> the individual sender except where they are stated to be the views of RDF
> Group plc. All messages passing through this gateway are virus scanned.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf2196621.html#a6094231
Sent from the ServiceMix - User forum at Nabble.com.


RE: JMS sample consumer/provider with JBossMQ

Posted by johper <ka...@hotmail.com>.
I finally got it to work. Thankyou very much Sufyan, you really really made
my day!!
/Johan


Sufyan Arif wrote:
> 
> We use a single servicemix.xml file and deploy servicemix inside a war.
> This is done with the usual way of initialising spring within a web.xml.
> So for e.g. the following is how to configure spring and servicemix in
> web.xml. Note the context class parameter is a special xbean app context
> thus able to understand the servicemix xbean based conf file.
> 
>   <context-param>
>     <param-name>contextConfigLocation</param-name>
>     <param-value>/WEB-INF/classes/servicemix.xml</param-value>
>   </context-param>
>   <context-param>
>     <param-name>contextClass</param-name>
>  
> <param-value>org.apache.xbean.spring.context.XmlWebApplicationContext</p
> aram-value>
>   </context-param>
> 
>   <listener>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</l
> istener-class>
>   </listener>
> 
> Also if you download the src distribution of servicemix there is
> servicemix-web folder which shows how to create a servimix deployment
> with a war file.
> 
> Thanks
> Sufyan
> 
> -----Original Message-----
> From: johper [mailto:karljpersson@hotmail.com] 
> Sent: 01 September 2006 08:50
> To: servicemix-users@geronimo.apache.org
> Subject: RE: JMS sample consumer/provider with JBossMQ
> 
> 
> Hello Sufyan, thanks for you reply and sample code. If I only could get
> it to
> work :-) !
> I have been struggling with "xbean deployment" and the "servicemix-jms"
> component and build a service assemby with Maven.
> Do you deploy your sample all in one "servicemix.xml" file or do you
> wrap it
> in a "service assembly" ? Maybe it is my packaging that is wrong??
> /johan
> 
> 
> Sufyan Arif wrote:
>> 
>> Hi,
>> 
>> We are also using jboss mq both to consume and deliver messages from
>> within servicemix. We used Spring to set up the connection factory
>> needed to communicate with the jms provider. I have included the
>> configuration that we use.
>> 
>> Thanks
>> Sufyan
>> 
>>   <sm:activationSpec id="jmsConsumers">
>>       <sm:component>
>>         <jms:component>
>>         <jms:endpoints>
>>           <jms:endpoint service="rdf:jmsConsumer"
>>                              endpoint="jmsConsumer"
>>                              targetService="rdf:router"
>>                              role="consumer"
>>  
>> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>>                              destinationStyle="queue"
>>                              destination="#esbDestination"
>>  
>> connectionFactory="#jmsQueueConnectionFactory" />
>> 
>>                <jms:endpoint service="rdf:mortgageApplicationConsumer"
>>                         endpoint="mortgageApplicationConsumer"
>>                             targetService="rdf:router"
>>                              role="consumer"
>>  
>> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>>                              destinationStyle="queue"
>>  
>> destination="#mortgageApplicationDestination"
>>  
>> connectionFactory="#jmsQueueConnectionFactory" />
>> 
>>                   </jms:endpoints>
>>            </jms:component>
>>      </sm:component>
>>   </sm:activationSpec>
>> 
>> 
>>   <bean id="jndiTemplate"
> class="org.springframework.jndi.JndiTemplate">
>>       <property name="environment">
>>           <props>
>>               <prop
>>
> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactor
>> y</prop>
>>               <prop
> key="java.naming.provider.url">localhost:1099</prop>
>>               <prop
>>
> key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</
>> prop>
>>           </props>
>>       </property>
>>   </bean>
>> 
>>   <bean id="jmsQueueConnectionFactory"
>>           class="org.springframework.jndi.JndiObjectFactoryBean">
>>       <property name="jndiTemplate">
>>         <ref bean="jndiTemplate"/>
>>       </property>
>>       <property name="jndiName">
>>           <value>UIL2ConnectionFactory</value>
>>       </property>
>>   </bean>
>> 
>>   <!-- Queue used for delaying sending of the mortgage application -->
>>   <bean id="mortgageApplicationDestination"
>>         class="org.springframework.jndi.JndiObjectFactoryBean">
>>       <property name="jndiTemplate">
>>           <ref bean="jndiTemplate"/>
>>       </property>
>>       <property name="jndiName">
>>           <value>queue/mortgageApplicationQueue</value>
>>       </property>
>>   </bean>
>> 
>>   <!-- Entry point into the esb for async comms -->
>>   <bean id="esbDestination"
>>         class="org.springframework.jndi.JndiObjectFactoryBean">
>>       <property name="jndiTemplate">
>>           <ref bean="jndiTemplate"/>
>>       </property>
>>       <property name="jndiName">
>>           <value>queue/esbQueue</value>
>>       </property>
>>   </bean>
>> 
>>   <bean id="jmsTemplate"
>>           class="org.springframework.jms.core.JmsTemplate">
>>       <property name="connectionFactory">
>>           <ref bean="jmsQueueConnectionFactory"/>
>>       </property>
>>       <property name="defaultDestination">
>>           <ref bean="mortgageApplicationDestination"/>
>>       </property>
>>       <property name="receiveTimeout">
>>           <value>30000</value>
>>       </property>
>>   </bean>
>> 
>> 
>> -----Original Message-----
>> From: johper [mailto:karljpersson@hotmail.com] 
>> Sent: 31 August 2006 14:10
>> To: servicemix-users@geronimo.apache.org
>> Subject: JMS sample consumer/provider with JBossMQ
>> 
>> 
>> Hi,
>> Been trying all kind of snippets from around this forum and internet.
>> With
>> no luck :-(
>> 
>> I built SM-SAR yesterday and deployed SM-SAR into JBoss. Everything
>> works
>> fine. ActiveMQ whitin SM works fine, JBossMQ within Jboss works fine
>> (having
>> MDB's etc etc.
>> Now I would like SM to receive and send messages to/from JBossMQ.
>> 
>> When using SM-SAR and JBoss they sit in the same VM, should local or
>> remote
>> JNDI names be used (seen both in samples) ? 
>> 
>> Please point in some direction or post at complete working sample. We
>> really
>> need to integrate SM and Jboss asap.
>> 
>> tia-jp
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf219662
>> 1.html#a6079036
>> Sent from the ServiceMix - User forum at Nabble.com.
>> 
>> 
>> This transmission is confidential and intended solely for the person
> or
>> organisation to whom it is addressed. It may contain privileged and
>> confidential information. If you are not the intended recipient, you
>> should not copy, distribute or take any action in reliance on it. If
> you
>> have received this transmission in error, please notify the sender
>> immediately. Any opinions or advice contained in this e-mail are those
> of
>> the individual sender except where they are stated to be the views of
> RDF
>> Group plc. All messages passing through this gateway are virus
> scanned.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf219662
> 1.html#a6094231
> Sent from the ServiceMix - User forum at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf2196621.html#a6095991
Sent from the ServiceMix - User forum at Nabble.com.


RE: JMS sample consumer/provider with JBossMQ

Posted by Sufyan Arif <SA...@rdfgroup.com>.
We use a single servicemix.xml file and deploy servicemix inside a war.
This is done with the usual way of initialising spring within a web.xml.
So for e.g. the following is how to configure spring and servicemix in
web.xml. Note the context class parameter is a special xbean app context
thus able to understand the servicemix xbean based conf file.

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/classes/servicemix.xml</param-value>
  </context-param>
  <context-param>
    <param-name>contextClass</param-name>
 
<param-value>org.apache.xbean.spring.context.XmlWebApplicationContext</p
aram-value>
  </context-param>

  <listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</l
istener-class>
  </listener>

Also if you download the src distribution of servicemix there is
servicemix-web folder which shows how to create a servimix deployment
with a war file.

Thanks
Sufyan

-----Original Message-----
From: johper [mailto:karljpersson@hotmail.com] 
Sent: 01 September 2006 08:50
To: servicemix-users@geronimo.apache.org
Subject: RE: JMS sample consumer/provider with JBossMQ


Hello Sufyan, thanks for you reply and sample code. If I only could get
it to
work :-) !
I have been struggling with "xbean deployment" and the "servicemix-jms"
component and build a service assemby with Maven.
Do you deploy your sample all in one "servicemix.xml" file or do you
wrap it
in a "service assembly" ? Maybe it is my packaging that is wrong??
/johan


Sufyan Arif wrote:
> 
> Hi,
> 
> We are also using jboss mq both to consume and deliver messages from
> within servicemix. We used Spring to set up the connection factory
> needed to communicate with the jms provider. I have included the
> configuration that we use.
> 
> Thanks
> Sufyan
> 
>   <sm:activationSpec id="jmsConsumers">
>       <sm:component>
>         <jms:component>
>         <jms:endpoints>
>           <jms:endpoint service="rdf:jmsConsumer"
>                              endpoint="jmsConsumer"
>                              targetService="rdf:router"
>                              role="consumer"
>  
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>                              destinationStyle="queue"
>                              destination="#esbDestination"
>  
> connectionFactory="#jmsQueueConnectionFactory" />
> 
>                <jms:endpoint service="rdf:mortgageApplicationConsumer"
>                         endpoint="mortgageApplicationConsumer"
>                             targetService="rdf:router"
>                              role="consumer"
>  
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>                              destinationStyle="queue"
>  
> destination="#mortgageApplicationDestination"
>  
> connectionFactory="#jmsQueueConnectionFactory" />
> 
>                   </jms:endpoints>
>            </jms:component>
>      </sm:component>
>   </sm:activationSpec>
> 
> 
>   <bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
>       <property name="environment">
>           <props>
>               <prop
>
key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactor
> y</prop>
>               <prop
key="java.naming.provider.url">localhost:1099</prop>
>               <prop
>
key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</
> prop>
>           </props>
>       </property>
>   </bean>
> 
>   <bean id="jmsQueueConnectionFactory"
>           class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>         <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>UIL2ConnectionFactory</value>
>       </property>
>   </bean>
> 
>   <!-- Queue used for delaying sending of the mortgage application -->
>   <bean id="mortgageApplicationDestination"
>         class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>           <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>queue/mortgageApplicationQueue</value>
>       </property>
>   </bean>
> 
>   <!-- Entry point into the esb for async comms -->
>   <bean id="esbDestination"
>         class="org.springframework.jndi.JndiObjectFactoryBean">
>       <property name="jndiTemplate">
>           <ref bean="jndiTemplate"/>
>       </property>
>       <property name="jndiName">
>           <value>queue/esbQueue</value>
>       </property>
>   </bean>
> 
>   <bean id="jmsTemplate"
>           class="org.springframework.jms.core.JmsTemplate">
>       <property name="connectionFactory">
>           <ref bean="jmsQueueConnectionFactory"/>
>       </property>
>       <property name="defaultDestination">
>           <ref bean="mortgageApplicationDestination"/>
>       </property>
>       <property name="receiveTimeout">
>           <value>30000</value>
>       </property>
>   </bean>
> 
> 
> -----Original Message-----
> From: johper [mailto:karljpersson@hotmail.com] 
> Sent: 31 August 2006 14:10
> To: servicemix-users@geronimo.apache.org
> Subject: JMS sample consumer/provider with JBossMQ
> 
> 
> Hi,
> Been trying all kind of snippets from around this forum and internet.
> With
> no luck :-(
> 
> I built SM-SAR yesterday and deployed SM-SAR into JBoss. Everything
> works
> fine. ActiveMQ whitin SM works fine, JBossMQ within Jboss works fine
> (having
> MDB's etc etc.
> Now I would like SM to receive and send messages to/from JBossMQ.
> 
> When using SM-SAR and JBoss they sit in the same VM, should local or
> remote
> JNDI names be used (seen both in samples) ? 
> 
> Please point in some direction or post at complete working sample. We
> really
> need to integrate SM and Jboss asap.
> 
> tia-jp
> -- 
> View this message in context:
>
http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf219662
> 1.html#a6079036
> Sent from the ServiceMix - User forum at Nabble.com.
> 
> 
> This transmission is confidential and intended solely for the person
or
> organisation to whom it is addressed. It may contain privileged and
> confidential information. If you are not the intended recipient, you
> should not copy, distribute or take any action in reliance on it. If
you
> have received this transmission in error, please notify the sender
> immediately. Any opinions or advice contained in this e-mail are those
of
> the individual sender except where they are stated to be the views of
RDF
> Group plc. All messages passing through this gateway are virus
scanned.
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/JMS-sample-consumer-provider-with-JBossMQ-tf219662
1.html#a6094231
Sent from the ServiceMix - User forum at Nabble.com.