activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jimmy007 <tech.arunaggarwal...@gmail.com>
Subject My Msg body show null
Date Mon, 02 Feb 2009 09:32:59 GMT

hi,

I am new to activemq using it with spring configuration in java.
I have a problem that whenever i send a simple text my consumer recieved
that perfectly but when 
i send a object it shown me null ?

plz help me i send my code added here

My Producer is

public class Client {
	
	public static void main(String[] args) {
		
	
		try
		{
		System.out.println("Camel client call");
		ApplicationContext context = new
ClassPathXmlApplicationContext("camel-client.xml");

        // get the camel template for Spring template style sending of
messages (= producer)
        ProducerTemplate camelTemplate = (ProducerTemplate)
context.getBean("smsGatewayTemplate");

        System.out.println("Invoking client");
        // as opposed to the CamelClientRemoting example we need to define
the service URI in this java code
      
        ActiveMQTextMessage message=new ActiveMQTextMessage();
        message.setText("hello server");
        message.setCorrelationId("1234567788");
        camelTemplate.sendBody("smsGatewayComponent1:queue:inputQueue", 
ExchangePattern.InOnly, message);
       // camelTemplate.sendBody("smsGatewayComponent1:queue:inputQueue",
ExchangePattern.InOnly, "my Message to server");
        System.out.println("Message send");
         
		}catch (Exception e) {

			e.printStackTrace();
		}
		
	}
	

}

It's xml file is

<camel:camelContext id="smsGatewayCamel">
		<camel:package>com.stpl.example</camel:package>
		<camel:jmxAgent id="agent" createConnector="true" />
		<camel:endpoint id="inputQueue" uri="activemq:$(inputQueue)"/>
	</camel:camelContext>
	
	
	<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
				<property name="brokerURL" value="tcp://localhost:61612" />
	</bean>
	
	
	<bean id="smsGatewayComponent"
class="org.apache.camel.component.jms.JmsComponent">
		<property name="connectionFactory" ref="connectionFactory"/>
	</bean>

my consumer having embedded broker

public class Server{

	public static void main(String[] args) {
		ApplicationContext context=new
FileSystemXmlApplicationContext("camel-server.xml");
		try {
			System.out.println("Server started");
			System.in.read();
		}	

		} catch (Exception e) {
				e.printStackTrace();
		}
			
	}


}
 
Its xml file

<camel:camelContext id="smsGatewayCamel">
		<camel:package>com.stpl.example</camel:package>
		<camel:jmxAgent id="agent" createConnector="true" />
		
		 <camel:template id="smsGatewayCamelTemplate"/>
		 
		<camel:endpoint id="outputQueue"
uri="smsGatewayComponent:queue:outputQueue"/>
		<camel:endpoint id="inputQueue"
uri="smsGatewayComponent:queue:inputQueue"/>	
		
		<camel:route>
		<camel:from uri="inputQueue"/>
		<camel:to uri="bean:clientListener"/>
		</camel:route>
 		
	
	</camel:camelContext>
	
	
	<!-- Broker Start here -->
	<broker:broker useJmx="false" persistent="false"
		brokerName="smsGatewayBroker">
		
		<!-- 
		<broker:persistenceAdapter> <broker:jdbcPersistenceAdapter
dataSource="mysql-ds"></broker:jdbcPersistenceAdapter></broker:persistenceAdapter>
         -->
			    		
		<broker:transportConnectors>
			<broker:transportConnector name="tcp" uri="tcp://localhost:61612" />
		</broker:transportConnectors>

	</broker:broker>

<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
				<property name="brokerURL" value="tcp://localhost:61612" />
	</bean>
	
	
	<bean id="smsGatewayComponent"
class="org.apache.camel.component.jms.JmsComponent">
		<property name="connectionFactory" ref="connectionFactory"/>
	</bean>
		
	<bean id="clientListener" class="com.stpl.example.ClientListener"></bean>
		
		
</beans>


Plz HelpMe to solve this problem :confused:
-- 
View this message in context: http://www.nabble.com/My-Msg-body-show-null-tp21786592p21786592.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message