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