@Override public DeadlineManager buildDeadlineManager(Configuration configuration) { try { Scheduler scheduler = new StdSchedulerFactory().getScheduler(); QuartzDeadlineManager quartzDeadlineManager = QuartzDeadlineManager.builder() .scheduler(scheduler) .scopeAwareProvider(new ConfigurationScopeAwareProvider(configuration)) .build(); scheduler.start(); return quartzDeadlineManager; } catch (SchedulerException e) { throw new AxonConfigurationException("Unable to configure quartz scheduler", e); } } }
/** * Instantiate a {@link QuartzDeadlineManager} based on the fields contained in the {@link Builder}. * <p> * Will assert that the {@link Scheduler}, {@link ScopeAwareProvider}, {@link TransactionManager} and * {@link Serializer} are not {@code null}, and will throw an {@link AxonConfigurationException} if any of them is * {@code null}. * The TransactionManager, ScopeAwareProvider and Serializer will be tied to the Scheduler's context. If this * initialization step fails, this will too result in an AxonConfigurationException. * * @param builder the {@link Builder} used to instantiate a {@link QuartzDeadlineManager} instance */ protected QuartzDeadlineManager(Builder builder) { builder.validate(); this.scheduler = builder.scheduler; this.scopeAwareProvider = builder.scopeAwareProvider; this.transactionManager = builder.transactionManager; this.serializer = builder.serializer; try { initialize(); } catch (SchedulerException e) { throw new AxonConfigurationException("Unable to initialize QuartzDeadlineManager", e); } }
/** * Instantiate a Builder to be able to create a {@link QuartzDeadlineManager}. * <p> * The {@link TransactionManager} is defaulted to an {@link NoTransactionManager}, and the {@link Serializer} to a * {@link XStreamSerializer}. The {@link Scheduler} and {@link ScopeAwareProvider} are <b>hard requirements</b> and * as such should be provided. * * @return a Builder to be able to create a {@link QuartzDeadlineManager} */ public static Builder builder() { return new Builder(); }
/** * Instantiate a {@link QuartzDeadlineManager} based on the fields contained in the {@link Builder}. * <p> * Will assert that the {@link Scheduler}, {@link ScopeAwareProvider}, {@link TransactionManager} and * {@link Serializer} are not {@code null}, and will throw an {@link AxonConfigurationException} if any of them is * {@code null}. * The TransactionManager, ScopeAwareProvider and Serializer will be tied to the Scheduler's context. If this * initialization step fails, this will too result in an AxonConfigurationException. * * @param builder the {@link Builder} used to instantiate a {@link QuartzDeadlineManager} instance */ protected QuartzDeadlineManager(Builder builder) { builder.validate(); this.scheduler = builder.scheduler; this.scopeAwareProvider = builder.scopeAwareProvider; this.transactionManager = builder.transactionManager; this.serializer = builder.serializer; try { initialize(); } catch (SchedulerException e) { throw new AxonConfigurationException("Unable to initialize QuartzDeadlineManager", e); } }
/** * Instantiate a Builder to be able to create a {@link QuartzDeadlineManager}. * <p> * The {@link TransactionManager} is defaulted to an {@link NoTransactionManager}, and the {@link Serializer} to a * {@link XStreamSerializer}. The {@link Scheduler} and {@link ScopeAwareProvider} are <b>hard requirements</b> and * as such should be provided. * * @return a Builder to be able to create a {@link QuartzDeadlineManager} */ public static Builder builder() { return new Builder(); }