Announcement Announcement Module
Collapse
No announcement yet.
Can SchedulerFactoryBean be made aware of AbstractRoutingDataSource? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can SchedulerFactoryBean be made aware of AbstractRoutingDataSource?

    I am trying to setup org.springframework.jdbc.datasource.lookup.Abstrac tRoutingDataSource and am wondering if this dynamic data source routing can be integrated with Quartz. If we have SchedulerFactoryBean defined as:

    Code:
    <bean id="cronSchedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
    		p:dataSource-ref="quartzDS">
    ....
    	</bean>
    And quartzDS is a routing data source like:

    Code:
    <bean id="quartzDS" class="xxx.xxx.xxx.CustomRoutingDataSource">
       <property name="targetDataSources">
          <map key-type="xxx.xxx.xxx.DSKeyType">
             <entry key="T1" value-ref="quartzDS1"/>
             <entry key="T2" value-ref="quartzDS2"/>
          </map>
       </property>
       <property name="defaultTargetDataSource" ref="quartzDS1"/>
    </bean>
    Can this actually work? I am finding that jobs that are scheduled on defaultTargetDataSource (quartzDS1) are firing correctly while jobs scheduled in other datasources are not firing.

    Thanks
Working...
X