camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elezabeth <Elezabeth.greg...@ibsplc.com>
Subject Camel and tomcat
Date Tue, 25 Sep 2012 12:55:01 GMT
Hi ,I am trying to make use of  camel in tomcat server. My requirement is to
read a cvs file in a folder whenever a *http request* is hit. I was able to
do this successfully using camel when I was using the "Run as a Java
application" in y IDE.Now I have to do the same thing in "Run on server" and
I using tomcat server 7.0 .  But now nothing is working..  I am not able to
understand wat exactly is happening. I checked the camel servlet tomcat
example.But that couldn't help me..I am pasting my code
below./*OagProcessor.java*/public class OagProcessor extends RouteBuilder {   
DataFormat bindy = new BindyCsvDataFormat(           
"jp.co.airlink.gavss.adapter.eai.oag.job");    Exchange exchnge = null;   
String fileName = null;    @Override    public void configure() throws
Exception {        System.out.println("in configure");       
from("http://localhost:8080/test").inOnly("seda:myfile");       
from("seda:myfile").inOnly("bean:fileConsumer?method=consumeFile")               
.unmarshal(bindy)               
.to("bean:validateFileInput?method=receiveOagData");   
}}*/FileConsumer.java/*public class FileConsumer {		@Inject	private
ConsumerTemplate consumer;		@Inject	private ProducerTemplate producer;	
public void setConsumer(ConsumerTemplate consumer) {		this.consumer =
consumer;	}		public void setProducer(ProducerTemplate producer) {	
this.producer = producer;	}	public void consumeFile(Exchange exchange)
throws Exception {		System.out.println("File Name in Consumer ->
"+exchange.getIn().getHeaders());		String fileName =
(String)exchange.getIn().getHeader("filename");		Exchange recievedEx =
consumer.receive("file:d:/a/?fileName="+fileName);	
System.out.println("Recieved ->
"+recievedEx.getIn().getBody().getClass().getName());				InputStream
inputStream =
GenericFileConverter.genericFileToInputStream((GenericFile<?>)recievedEx.getIn().getBody(),
recievedEx);		System.out.println("InputStream >>> "+inputStream);			
exchange.getIn().setBody(inputStream);		//producer.sendBody("seda:myfile",
inputStream);	}}*/camel-context.xml/*															  								
*/web.xml/*s<?xml version="1.0" encoding="UTF-8"?>		
org.springframework.web.context.ContextLoaderListener			 	
contextConfigLocation		/WEB-INF/conf/bootstrap.xml
/WEB-INF/spring/camel-context.xml	 				appServlet	
org.springframework.web.servlet.DispatcherServlet					contextConfigLocation					
/WEB-INF/conf/bootstrap.xml							1				mySerlvet	
org.apache.camel.component.servlet.CamelHttpTransportServlet				
contextConfigLocation						/WEB-INF/spring/camel-context.xml								2			
myServlet		/				appServlet		/	 		DB Connection		jdbc/gavss	
javax.sql.DataSource		Container	 web.xml is the portion where I am not very
quite sure of. I started my server.. the only thing I get in the console log
is  File Name in Consumer -> null....Can anyone tell me what is wrong here?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-and-tomcat-tp5719942.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message