You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Raj@nih" <yr...@gmail.com> on 2007/10/03 19:54:23 UTC

How to build SA using bean SU and jms consumer SU and debug and deploy in eclipse

Hi,
I made an SA successfully using the servicemix-bean su and  jms-consumer su
and used mvn command  
to make SA out of them and build was successful.I wrote a client jms program
that sends the message.But I couldn't get response back from bean I am using
simple inout echo bean that you listed on the site.
I think problem is with my xbean and target point
i am sending both here.


beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
       xmlns:y="http://localhost:8192/yrkproject">

  <bean:endpoint service="y:service"
endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectinput"
bean="#myBean"/>

  <bean id="myBean" class="org.apache.YrkProject.MyBean"/>
</beans>

beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
       xmlns:y="http://localhost:8192/yrkproject"
       xmlns:amq="http://activemq.org/config/1.0">

   
    <jms:endpoint service="y:yrkproject"
                 
endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
                  targetService="y:yrkproject"
                 
targetEndpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
                  role="consumer"
                  destinationStyle="queue"
                 
jmsProviderDestinationName="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                  defaultOperation="test:Echo"
                  connectionFactory="#connectionFactory" />
     <bean id="#connectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="tcp://localhost:61616"/>
            </bean>
        </property>          
    </bean>              
   

   

</beans>



This is my client

package nih.nci.gov.caXchange;
import javax.jbi.messaging.InOut;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.jbi.jaxp.StringSource;
import javax.xml.namespace.QName;
import javax.jms.*;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;


public class TestJmsClient {

        /**
         * @param args
         */
        public static void main(String[] args) throws JMSException{
                 System.out.println("Connecting to JMS server.");
                  // ActiveMQ JMS Provider code
        ActiveMQConnectionFactory factory =                        
            new ActiveMQConnectionFactory("tcp://localhost:61616");
        Destination inQueue = new
ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectsource");
        Destination outQueue = new
ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectoutput");
        Connection connection = factory.createConnection();        
        Session session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
     // Create the message 66 and consumer
        MessageProducer producer = session.createProducer(inQueue);  
        System.out.println("Producer got this:  "+producer);
        MessageConsumer consumer = session.createConsumer(outQueue);
        System.out.println("Consumer got this:   "+consumer);
        connection.start();  
        System.out.println("Sending request.");                    
        //producer.send(session.createTextMessage("<message>Hello,
world!</message>"));
        TextMessage tMsg = session.createTextMessage("Yogi");
        System.out.println(tMsg);
        tMsg.setJMSReplyTo(inQueue);
        producer.send(tMsg);
        connection.close();
        System.out.println("Done.");
       
       
       
               
        }
       
          /*public void init(ComponentContext context) throws JBIException {
          this.context = context;
          context.activateEndpoint(new QName("http://your.namespace",
"service"), "endpoint");
  }*/
       
        /*public void testEcho() throws Exception {
                DefaultServiceMixClient client = new
DefaultServiceMixClient(jbi);
                InOut me = client.createInOutExchange();
                me.setService(new QName("http://bpmscript.org/jbi",
"timeout"));
                me.getInMessage().setContent(new
StringSource("<hello>world</hello>"));
                ssertTrue(client.sendSync(me, 1000000));
                Exception error = me.getError();
                assertTrue(error instanceof TimeoutException);
                                } */

}


Can any one suggest me how do I get reply back from servicemix bean.
Regards,
Raj
-- 
View this message in context: http://www.nabble.com/How-to-build-SA-using-bean-SU-and-jms-consumer-SU-and-debug-and-deploy-in-eclipse-tf4563348s12049.html#a13024209
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: How to build SA using bean SU and jms consumer SU and debug and deploy in eclipse

Posted by Gert Vanthienen <ge...@skynet.be>.
Yogaraj,

I'm forwarding this message to the users mailing list.  The dev mailing 
list is meant for discussing development on the ServiceMix project itself.

As far as your JMS consumer endpoint configuration is concerned, here is 
a snippet that should work:
<jms:consumer service="y:yrkproject"
               endpoint="n.n.g.c.org.servicemix.yrkprojectsource"
               destinationName="MY.QUEUE.NAME"
               connectionFactory="#ConnectionFactory"
               defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
               targetService="y:service"/>

Regards,

Gert

Raj@nih wrote:
> Can you just send me the sample configuration files with the minimum
> requrired field for the xbean for the jms-consumer su that sends messge to
> the nmr 
> and bean su that listens to the messge back to the nmr 
> i mean so that i can't get response back to my client program.
> Regards,
> Yogaraj
> 
> 
> 
> Raj@nih wrote:
>> Hi,
>> I made an SA successfully using the servicemix-bean su and  jms-consumer
>> su and used mvn command  
>> to make SA out of them and build was successful.I wrote a client jms
>> program that sends the message.But I couldn't get response back from bean
>> I am using simple inout echo bean that you listed on the site.
>> I think problem is with my xbean and target point
>> i am sending both here.
>>
>>
>> beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
>>        xmlns:y="http://localhost:8192/yrkproject">
>>
>>   <bean:endpoint service="y:service"
>> endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectinput"
>> bean="#myBean"/>
>>
>>   <bean id="myBean" class="org.apache.YrkProject.MyBean"/>
>> </beans>
>>
>> beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>>        xmlns:y="http://localhost:8192/yrkproject"
>>        xmlns:amq="http://activemq.org/config/1.0">
>>
>>    
>>     <jms:endpoint service="y:yrkproject"
>>                  
>> endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>>                   targetService="y:yrkproject"
>>                  
>> targetEndpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>>                   role="consumer"
>>                   destinationStyle="queue"
>>                  
>> jmsProviderDestinationName="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>>                   defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>>                   defaultOperation="test:Echo"
>>                   connectionFactory="#connectionFactory" />
>>      <bean id="#connectionFactory"
>> class="org.apache.activemq.pool.PooledConnectionFactory">
>>         <property name="connectionFactory">
>>             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>                 <property name="brokerURL" value="tcp://localhost:61616"/>
>>             </bean>
>>         </property>          
>>     </bean>              
>>    
>>
>>    
>>
>> </beans>
>>
>>
>>
>> This is my client
>>
>> package nih.nci.gov.caXchange;
>> import javax.jbi.messaging.InOut;
>> import org.apache.servicemix.client.DefaultServiceMixClient;
>> import org.apache.servicemix.jbi.jaxp.StringSource;
>> import javax.xml.namespace.QName;
>> import javax.jms.*;
>>
>> import org.apache.activemq.ActiveMQConnectionFactory;
>> import org.apache.activemq.command.ActiveMQQueue;
>>
>>
>> public class TestJmsClient {
>>
>>         /**
>>          * @param args
>>          */
>>         public static void main(String[] args) throws JMSException{
>>                  System.out.println("Connecting to JMS server.");
>>                   // ActiveMQ JMS Provider code
>>         ActiveMQConnectionFactory factory =                        
>>             new ActiveMQConnectionFactory("tcp://localhost:61616");
>>         Destination inQueue = new
>> ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectsource");
>>         Destination outQueue = new
>> ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectoutput");
>>         Connection connection = factory.createConnection();        
>>         Session session = connection.createSession(false,
>> Session.CLIENT_ACKNOWLEDGE);
>>      // Create the message 66 and consumer
>>         MessageProducer producer = session.createProducer(inQueue);  
>>         System.out.println("Producer got this:  "+producer);
>>         MessageConsumer consumer = session.createConsumer(outQueue);
>>         System.out.println("Consumer got this:   "+consumer);
>>         connection.start();  
>>         System.out.println("Sending request.");                    
>>         //producer.send(session.createTextMessage("<message>Hello,
>> world!</message>"));
>>         TextMessage tMsg = session.createTextMessage("Yogi");
>>         System.out.println(tMsg);
>>         tMsg.setJMSReplyTo(inQueue);
>>         producer.send(tMsg);
>>         connection.close();
>>         System.out.println("Done.");
>>        
>>        
>>        
>>                
>>         }
>>        
>>           /*public void init(ComponentContext context) throws JBIException
>> {
>>           this.context = context;
>>           context.activateEndpoint(new QName("http://your.namespace",
>> "service"), "endpoint");
>>   }*/
>>        
>>         /*public void testEcho() throws Exception {
>>                 DefaultServiceMixClient client = new
>> DefaultServiceMixClient(jbi);
>>                 InOut me = client.createInOutExchange();
>>                 me.setService(new QName("http://bpmscript.org/jbi",
>> "timeout"));
>>                 me.getInMessage().setContent(new
>> StringSource("<hello>world</hello>"));
>>                 ssertTrue(client.sendSync(me, 1000000));
>>                 Exception error = me.getError();
>>                 assertTrue(error instanceof TimeoutException);
>>                                 } */
>>
>> }
>>
>>
>> Can any one suggest me how do I get reply back from servicemix bean.
>> Regards,
>> Raj
>>
> 

Re: How to build SA using bean SU and jms consumer SU and debug and deploy in eclipse

Posted by "Raj@nih" <yr...@gmail.com>.
Can you just send me the sample configuration files with the minimum
requrired field for the xbean for the jms-consumer su that sends messge to
the nmr 
and bean su that listens to the messge back to the nmr 
i mean so that i can't get response back to my client program.
Regards,
Yogaraj



Raj@nih wrote:
> 
> Hi,
> I made an SA successfully using the servicemix-bean su and  jms-consumer
> su and used mvn command  
> to make SA out of them and build was successful.I wrote a client jms
> program that sends the message.But I couldn't get response back from bean
> I am using simple inout echo bean that you listed on the site.
> I think problem is with my xbean and target point
> i am sending both here.
> 
> 
> beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
>        xmlns:y="http://localhost:8192/yrkproject">
> 
>   <bean:endpoint service="y:service"
> endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectinput"
> bean="#myBean"/>
> 
>   <bean id="myBean" class="org.apache.YrkProject.MyBean"/>
> </beans>
> 
> beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>        xmlns:y="http://localhost:8192/yrkproject"
>        xmlns:amq="http://activemq.org/config/1.0">
> 
>    
>     <jms:endpoint service="y:yrkproject"
>                  
> endpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>                   targetService="y:yrkproject"
>                  
> targetEndpoint="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>                   role="consumer"
>                   destinationStyle="queue"
>                  
> jmsProviderDestinationName="nih.nci.gov.caXchange.org.servicemix.yrkprojectsource"
>                   defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                   defaultOperation="test:Echo"
>                   connectionFactory="#connectionFactory" />
>      <bean id="#connectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>         <property name="connectionFactory">
>             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL" value="tcp://localhost:61616"/>
>             </bean>
>         </property>          
>     </bean>              
>    
> 
>    
> 
> </beans>
> 
> 
> 
> This is my client
> 
> package nih.nci.gov.caXchange;
> import javax.jbi.messaging.InOut;
> import org.apache.servicemix.client.DefaultServiceMixClient;
> import org.apache.servicemix.jbi.jaxp.StringSource;
> import javax.xml.namespace.QName;
> import javax.jms.*;
> 
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.activemq.command.ActiveMQQueue;
> 
> 
> public class TestJmsClient {
> 
>         /**
>          * @param args
>          */
>         public static void main(String[] args) throws JMSException{
>                  System.out.println("Connecting to JMS server.");
>                   // ActiveMQ JMS Provider code
>         ActiveMQConnectionFactory factory =                        
>             new ActiveMQConnectionFactory("tcp://localhost:61616");
>         Destination inQueue = new
> ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectsource");
>         Destination outQueue = new
> ActiveMQQueue("nih.nci.gov.caXchange.org.servicemix.yrkprojectoutput");
>         Connection connection = factory.createConnection();        
>         Session session = connection.createSession(false,
> Session.CLIENT_ACKNOWLEDGE);
>      // Create the message 66 and consumer
>         MessageProducer producer = session.createProducer(inQueue);  
>         System.out.println("Producer got this:  "+producer);
>         MessageConsumer consumer = session.createConsumer(outQueue);
>         System.out.println("Consumer got this:   "+consumer);
>         connection.start();  
>         System.out.println("Sending request.");                    
>         //producer.send(session.createTextMessage("<message>Hello,
> world!</message>"));
>         TextMessage tMsg = session.createTextMessage("Yogi");
>         System.out.println(tMsg);
>         tMsg.setJMSReplyTo(inQueue);
>         producer.send(tMsg);
>         connection.close();
>         System.out.println("Done.");
>        
>        
>        
>                
>         }
>        
>           /*public void init(ComponentContext context) throws JBIException
> {
>           this.context = context;
>           context.activateEndpoint(new QName("http://your.namespace",
> "service"), "endpoint");
>   }*/
>        
>         /*public void testEcho() throws Exception {
>                 DefaultServiceMixClient client = new
> DefaultServiceMixClient(jbi);
>                 InOut me = client.createInOutExchange();
>                 me.setService(new QName("http://bpmscript.org/jbi",
> "timeout"));
>                 me.getInMessage().setContent(new
> StringSource("<hello>world</hello>"));
>                 ssertTrue(client.sendSync(me, 1000000));
>                 Exception error = me.getError();
>                 assertTrue(error instanceof TimeoutException);
>                                 } */
> 
> }
> 
> 
> Can any one suggest me how do I get reply back from servicemix bean.
> Regards,
> Raj
> 

-- 
View this message in context: http://www.nabble.com/How-to-build-SA-using-bean-SU-and-jms-consumer-SU-and-debug-and-deploy-in-eclipse-tf4563348s12049.html#a13025278
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.