Hi,
I am sending the message from my jms client to the bean for echo the request
in Inout MEPs.
I am not able to print the message from bean.Please suggest what might be
going wrong?
This is my bean

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.servicemix.yrkproject;

import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.jbi.util.MessageUtil;

import javax.annotation.Resource;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;

//import javax.jbi.component.*;

public class MyBean implements MessageExchangeListener {
        //private ComponentContext context; 

    @Resource
    private DeliveryChannel channel;
    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        System.out.println("This is from Bean EXCHANGE: " + exchange); 
        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
            MessageUtil.transferInToOut(exchange, exchange);
            channel.send(exchange);
        }
        
        
}
    /*public void setContext(javax.jbi.component.ComponentContext context) {
        this.context = context;
} */

}


This is my test 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("queueA");
        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);
        MessageConsumer consumer = session.createConsumer(outQueue);
        System.out.println("Producer got this:  "+producer);
        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("<message>Hello,
world!</message>");
        System.out.println(tMsg);
        tMsg.setJMSReplyTo(outQueue);
        producer.send(tMsg);

        TextMessage m = (TextMessage) consumer.receive(5000);
        try {
                System.out.println("My Response is: " +
String.valueOf(m.getText()));
        } catch (Exception ex){
                ex.printStackTrace();
        }
        connection.close();
        System.out.println("Done.");
        
        
        
                
        }
        
         

}


This is my output while running the client
Connecting to JMS server.
log4j:WARN No appenders could be found for logger
(org.apache.activemq.transport.WireFormatNegotiator).
log4j:WARN Please initialize the log4j system properly.
Producer got this:  ActiveMQMessageProducer {
value=ID:2115-khanaly-1-4565-1191942269154-1:0:1:1 }
Consumer got this:   ActiveMQMessageConsumer {
value=ID:2115-khanaly-1-4565-1191942269154-1:0:1:1, started=false }
Sending request.
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
null, originalDestination = null, originalTransactionId = null, producerId =
null, destination = null, transactionId = null, expiration = 0, timestamp =
0, arrival = 0, correlationId = null, replyTo = null, persistent = false,
type = null, priority = 0, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
size = 0, properties = null, readOnlyProperties = false, readOnlyBody =
false, droppable = false, text = <message>Hello, world!</message>}
My Response is: <?xml version='1.0' encoding='UTF-8'?><message>Hello,
world!</message>
Done.


I am wondering if I could step through the SOP line in MyBean.If can why am
not able to do and if can't why?Please reply me with  the reason.All your
previous responses were very valueable to me and helping me lot.Thanks all 
for the prompt and to the point solutions.
Regards,
Raj
-- 
View this message in context: 
http://www.nabble.com/Control-not-going-to-the-bean-while-debugging-tf4594787s12049.html#a13117507
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to