Hello Camel Community, 

I am new to Apache camel, this might be a very basic issue, but i am unable
to figure it out. 
 I am having some problem while making calls from jdc component to database
while having schedular on. 

I am getting an exception  like as follow 

INFO: Job execution threads will use class loader of thread: main 
Mar 14, 2013 1:14:20 PM org.quartz.simpl.RAMJobStore initialize 
INFO: RAMJobStore initialized. 
Mar 14, 2013 1:14:20 PM org.quartz.impl.StdSchedulerFactory instantiate 
INFO: Quartz scheduler 'DefaultQuartzScheduler-camel-1' initialized from an
externally provided properties instance. 
Mar 14, 2013 1:14:20 PM org.quartz.impl.StdSchedulerFactory instantiate 
INFO: Quartz scheduler version: 1.4.4 
Mar 14, 2013 1:14:23 PM org.quartz.core.QuartzScheduler shutdown 
INFO: Scheduler DefaultQuartzScheduler-camel-1_$_NON_CLUSTERED shutting
down. 
Mar 14, 2013 1:14:23 PM org.quartz.core.QuartzScheduler pause 
INFO: Scheduler DefaultQuartzScheduler-camel-1_$_NON_CLUSTERED paused. 
Mar 14, 2013 1:14:23 PM org.quartz.core.QuartzScheduler shutdown 
INFO: Scheduler DefaultQuartzScheduler-camel-1_$_NON_CLUSTERED shutdown
complete. 
java.lang.UnsupportedOperationException: Not supported 
        at
org.apache.camel.component.jdbc.JdbcEndpoint.createConsumer(JdbcEndpoint.java:52)
 
        at
org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65)
 
        at
org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:80) 
        at org.apache.camel.impl.RouteService.warmUp(RouteService.java:133) 
        at
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1986)
 
        at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1914)
 
        at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1702)
 
        at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1583)
 
        at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444)
 
        at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) 
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412) 
        at CamelTests.test(CamelTests.java:99) 
        at abc.main(abc.java:17) 


I am also pasting my calling code 

  
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; 
import java.util.List; 
import java.util.Map; 

import org.apache.camel.*; 

import org.apache.camel.builder.RouteBuilder; 
import org.apache.camel.component.jdbc.JdbcEndpoint; 
import org.apache.camel.component.mock.MockComponent; 
import org.apache.camel.component.mock.MockEndpoint; 
import org.apache.camel.component.quartz.QuartzComponent; 
import org.apache.camel.impl.DefaultCamelContext; 
import org.apache.camel.impl.JndiRegistry; 
import org.apache.camel.impl.SimpleRegistry; 
import org.apache.camel.test.junit4.CamelTestSupport; 
import org.apache.camel.util.jndi.JndiContext; 


/* 
 * To change this template, choose Tools | Templates and open the template
in 
 * the editor. 
 */ 
/** 
 * 
 * @author Uzair 
 */ 
public class CamelTests { 
    
    public void test() throws Exception { 
        
        JndiRegistry registry = new JndiRegistry(new JndiContext()); 
        final CamelContext camelCtxt = new DefaultCamelContext(registry); 
        MysqlDataSource datasource = getDataSource(); 
       final JdbcEndpoint endpoint = getJDBCEndPoint(datasource, camelCtxt); 
        
        registry.bind("intuira", getDataSource()); 
        
        camelCtxt.addEndpoint("direct:start", endpoint); 
        QuartzComponent quartz = new QuartzComponent(camelCtxt); 
        MockComponent mockComponent = new MockComponent(); 
        mockComponent.setCamelContext(camelCtxt); 
        Endpoint mockEndPoint =
mockComponent.createEndpoint("mock:results"); 
        camelCtxt.addEndpoint("mock:results", mockEndPoint); 

       RouteBuilder myRoute = new RouteBuilder(camelCtxt) { 

            
            @Override 
            public void configure() throws Exception { 
  
          
                
        ProducerTemplate producerTemplate =
camelCtxt.createProducerTemplate();     
    
        
        Endpoint jdbcEndpoint = camelCtxt.getEndpoint("direct:start"); 

        MyProcessor routeProcessor = new MyProcessor
(producerTemplate,jdbcEndpoint ,camelCtxt);       
                
from("direct:start").process(routeProcessor).to("jdbc:intuira"); 
            
                    
            } 
        }; 
        camelCtxt.addRoutes(myRoute); 
         camelCtxt.addRoutes(new RouteBuilder() { 

            @Override 
            public void configure() throws Exception { 
                 QuartzComponent quartz = camelCtxt.getComponent("quartz",
QuartzComponent.class); 
                 quartz.setStartDelayedSeconds(3); 
              
               
from("quartz://myGroup/myTimerName?cron=0+0/1+12-18+?+*+MON-FRI").routeId("myRoute").to("mock:results");
 
            } 
          
          
         }); 
        camelCtxt.start(); 
        
        Thread.sleep(100000); 

        camelCtxt.stop(); 

      
        
    } 
    
    private MysqlDataSource getDataSource() { 
        MysqlDataSource datasource = new MysqlDataSource(); 
        datasource.setUser("uzairkamal"); 
        datasource.setPassword("EaDqq2Ed2YeAQV2X"); 
        datasource.setDatabaseName("intuira_services_db"); 
        datasource.setServerName("172.29.4.40"); 
        return datasource; 
    } 
    
    private JdbcEndpoint getJDBCEndPoint(MysqlDataSource datasource,
CamelContext camelCtxt) { 
        
        JdbcEndpoint endpoint = new JdbcEndpoint(); 
        endpoint.setDataSource(datasource); 
        endpoint.setCamelContext(camelCtxt); 
        return endpoint; 
    } 
} 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Quartz-and-jdbc-tp5729168.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to