On Thu, Dec 15, 2011 at 8:52 AM, focaldi <[email protected]> wrote:
> I run it in Eclipse and I wrote a main method.
>
Make sure you got all the JARs on the classpath.
You may miss the http client JAR that the camel-http component uses.
> package aero.tav.ib;
>
> import static
> org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
>
> import javax.jms.ConnectionFactory;
>
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.camel.CamelContext;
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.impl.DefaultCamelContext;
> import org.apache.camel.impl.JndiRegistry;
> import org.apache.camel.util.jndi.JndiContext;
> import org.springframework.context.ApplicationContext;
> import org.springframework.context.support.ClassPathXmlApplicationContext;
> import org.springframework.jdbc.datasource.DriverManagerDataSource;
>
> import aero.tav.ib.configuration.ConfigurationManager;
> import aero.tav.ib.configuration.entity.Provider;
> import aero.tav.ib.configuration.entity.Source;
> import aero.tav.ib.sql.SqlProviderService;
> import aero.tav.ib.utils.ApplicationContextProvider;
> import aero.tav.ib.utils.CamelContextProvider;
>
> public class ApplicationTest {
>
> public static void main(String[] args) {
>
> CamelContext camelContext = null;
> try{
> camelContext = new DefaultCamelContext();
> camelContext.setHandleFault(true);
> CamelContextProvider.setContext(camelContext);
>
> ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("tcp://10.1.2.5:61616"); // ActiveMQ Machine
> camelContext.addComponent("jms",
> jmsComponentClientAcknowledge(connectionFactory));
> camelContext.addRoutes(new RouteBuilder() {
> @Override
> public void configure() throws Exception {
>
> from("timer://foo?fixedRate=true&delay=0&period=10000")
>
> .to("http://tcmb.gov.tr/kurlar/today.xml").process(new Processor() {
> @Override
> public void process(Exchange
> arg0) throws Exception {
>
> System.out.println(arg0.getIn());
> }
> });
> }
> });
> camelContext.getShutdownStrategy().setTimeout(10);
>
> // start the route and let it do its work
> camelContext.start();
> Thread.sleep(20*1000);
>
> // stop the CamelContext
> camelContext.stop();
>
> }catch(Exception ex){
> ex.printStackTrace();
> }
>
> }
>
> }
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-can-I-catch-a-response-http-component-tp5076707p5076790.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/