Search in sources :

Example 1 with JobEventConfiguration

use of com.dangdang.ddframe.job.event.JobEventConfiguration in project elastic-job by dangdangdotcom.

the class JavaMain method main.

// CHECKSTYLE:OFF
public static void main(final String[] args) throws IOException {
    // CHECKSTYLE:ON
    EmbedZookeeperServer.start(EMBED_ZOOKEEPER_PORT);
    CoordinatorRegistryCenter regCenter = setUpRegistryCenter();
    JobEventConfiguration jobEventConfig = new JobEventRdbConfiguration(setUpEventTraceDataSource());
    setUpSimpleJob(regCenter, jobEventConfig);
    setUpDataflowJob(regCenter, jobEventConfig);
    setUpScriptJob(regCenter, jobEventConfig);
}
Also used : JobEventRdbConfiguration(com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration) JobEventConfiguration(com.dangdang.ddframe.job.event.JobEventConfiguration) CoordinatorRegistryCenter(com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter)

Example 2 with JobEventConfiguration

use of com.dangdang.ddframe.job.event.JobEventConfiguration in project loc-framework by lord-of-code.

the class LocElasticJobAutoConfiguration method init.

private void init() {
    LocElasticJobProperties elasticJobProperties = resolverJobProperties();
    String[] jobs = this.applicationContext.getBeanNamesForAnnotation(LocElasticJob.class);
    ZookeeperRegistryCenter registryCenter = registerCenter(elasticJobProperties);
    JobEventConfiguration jobEventConfiguration = Optional.ofNullable(Strings.emptyToNull(elasticJobProperties.getDataSource())).map(s -> new JobEventRdbConfiguration(applicationContext.getBean(s + "Ds", DataSource.class))).orElse(null);
    createBean(registryCenter, jobEventConfiguration, jobs);
}
Also used : JobEventConfiguration(com.dangdang.ddframe.job.event.JobEventConfiguration) Arrays(java.util.Arrays) JobEventRdbConfiguration(com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration) BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) LocDataSourceAutoConfiguration(com.loc.framework.autoconfigure.jdbc.LocDataSourceAutoConfiguration) ArrayUtils(org.apache.commons.lang3.ArrayUtils) StringUtils(org.apache.commons.lang3.StringUtils) BeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry) ConfigurableListableBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) AutoConfigureAfter(org.springframework.boot.autoconfigure.AutoConfigureAfter) ScriptJobConfiguration(com.dangdang.ddframe.job.config.script.ScriptJobConfiguration) Strings(com.google.common.base.Strings) Lists(com.google.common.collect.Lists) ConfigurableEnvironment(org.springframework.core.env.ConfigurableEnvironment) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) DataSource(javax.sql.DataSource) ElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener) Nullable(org.springframework.lang.Nullable) SpringJobScheduler(com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler) ScriptJob(com.dangdang.ddframe.job.api.script.ScriptJob) Bindable(org.springframework.boot.context.properties.bind.Bindable) SimpleJob(com.dangdang.ddframe.job.api.simple.SimpleJob) ZookeeperConfiguration(com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration) FatalBeanException(org.springframework.beans.FatalBeanException) BeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor) Throwables(com.google.common.base.Throwables) BeansException(org.springframework.beans.BeansException) ConditionalOnPrefixProperty(com.loc.framework.autoconfigure.ConditionalOnPrefixProperty) DataflowJobConfiguration(com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration) ApplicationContext(org.springframework.context.ApplicationContext) JobCoreConfiguration(com.dangdang.ddframe.job.config.JobCoreConfiguration) Configuration(org.springframework.context.annotation.Configuration) ZookeeperRegistryCenter(com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) SimpleJobConfiguration(com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration) EnvironmentAware(org.springframework.context.EnvironmentAware) Environment(org.springframework.core.env.Environment) Optional(java.util.Optional) Preconditions(com.google.common.base.Preconditions) Binder(org.springframework.boot.context.properties.bind.Binder) DataflowJob(com.dangdang.ddframe.job.api.dataflow.DataflowJob) LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) ElasticJob(com.dangdang.ddframe.job.api.ElasticJob) ApplicationContextAware(org.springframework.context.ApplicationContextAware) BeanUtils(org.springframework.beans.BeanUtils) ZookeeperRegistryCenter(com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter) JobEventRdbConfiguration(com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration) JobEventConfiguration(com.dangdang.ddframe.job.event.JobEventConfiguration) DataSource(javax.sql.DataSource)

Aggregations

JobEventConfiguration (com.dangdang.ddframe.job.event.JobEventConfiguration)2 JobEventRdbConfiguration (com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration)2 ElasticJob (com.dangdang.ddframe.job.api.ElasticJob)1 DataflowJob (com.dangdang.ddframe.job.api.dataflow.DataflowJob)1 ScriptJob (com.dangdang.ddframe.job.api.script.ScriptJob)1 SimpleJob (com.dangdang.ddframe.job.api.simple.SimpleJob)1 JobCoreConfiguration (com.dangdang.ddframe.job.config.JobCoreConfiguration)1 DataflowJobConfiguration (com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration)1 ScriptJobConfiguration (com.dangdang.ddframe.job.config.script.ScriptJobConfiguration)1 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)1 ElasticJobListener (com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener)1 LiteJobConfiguration (com.dangdang.ddframe.job.lite.config.LiteJobConfiguration)1 SpringJobScheduler (com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler)1 CoordinatorRegistryCenter (com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter)1 ZookeeperConfiguration (com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration)1 ZookeeperRegistryCenter (com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter)1 Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 Throwables (com.google.common.base.Throwables)1 Lists (com.google.common.collect.Lists)1