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

Not able to print SOP from servicemix bean

Hi,
I am not able to print InOut MEPs in the servicemix bean
My bean looks like this


/*
 * 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);
        }
    	
    	
}
    
}


My client looks like 

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.");
        
        
        
		
	}
	
	 

}




My output console is:

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-3568-1191943138616-1:0:1:1 }
Consumer got this:   ActiveMQMessageConsumer {
value=ID:2115-khanaly-1-3568-1191943138616-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 not gettting 

System.out.println("This is from Bean EXCHANGE: " + exchange);  

from bean and not able to jump here using eclipse remote debugger too
Any suggestions how can I access servicemix bean?
Regards,
Raj
-- 
View this message in context: http://www.nabble.com/Not-able-to-print-SOP-from-servicemix-bean-tf4594895s12049.html#a13117866
Sent from the ServiceMix - User mailing list archive at Nabble.com.