Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2010-2011. Axon Framework
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.axonframework.eventhandling.scheduling.quartz;
 
Spring FactoryBean that creates a QuartzEventScheduler instance using resources found in the Spring Application Context. The QuartzEventScheduler delegates the actual scheduling and triggering to a Quartz Scheduler, making it more suitable for long-term triggers and triggers that must survive a system restart.

Author(s):
Allard Buijze
Since:
1.1
 
         ApplicationContextAware {
 
     private Scheduler scheduler;
     private EventBus eventBus;
     private String groupIdentifier;
 
 
     @Override
     public QuartzEventScheduler getObject() throws Exception {
         return ;
     }
 
     @Override
     public Class<?> getObjectType() {
         return QuartzEventScheduler.class;
     }
 
     @Override
     public boolean isSingleton() {
         return true;
     }
 
     @Override
     public void afterPropertiesSet() throws Exception {
         if ( == null) {
              = .getBean(EventBus.class);
         }
         if ( == null) {
              = .getBean(Scheduler.class);
         }
 
          = new QuartzEventScheduler();
         if ( != null) {
         }
         if ( != null) {
             SpringTransactionalTriggerCallback callback = new SpringTransactionalTriggerCallback();
             callback.setTransactionManager();
             if ( != null) {
                 callback.setTransactionDefinition();
             }
             .setEventTriggerCallback(callback);
         }
         .initialize();
     }
 
     @Override
     public void setApplicationContext(ApplicationContext applicationContextthrows BeansException {
         this. = applicationContext;
     }

    
Sets the backing Quartz Scheduler for this timer.

Parameters:
scheduler the backing Quartz Scheduler for this timer
    public void setScheduler(Scheduler scheduler) {
        this. = scheduler;
    }

    
Sets the event bus to which scheduled events need to be published.

Parameters:
eventBus the event bus to which scheduled events need to be published.
    public void setEventBus(EventBus eventBus) {
        this. = eventBus;
    }

    
Sets the group identifier to use when scheduling jobs with Quartz. Defaults to "AxonFramework-Events".

Parameters:
groupIdentifier the group identifier to use when scheduling jobs with Quartz
    public void setGroupIdentifier(String groupIdentifier) {
        this. = groupIdentifier;
    }

    
Sets the transaction manager that manages the transaction around the publication of an event. If a transaction manager is not specified, no transactions are managed around the event publication.

Parameters:
transactionManager the transaction manager that takes care of transactions around event publication
    public void setTransactionManager(PlatformTransactionManager transactionManager) {
        this. = transactionManager;
    }

    
The TransactionDefinition to use by the transaction manager. Default to a org.springframework.transaction.support.DefaultTransactionDefinition. Is ignored if no transaction manager is configured.

Parameters:
transactionDefinition the TransactionDefinition to use by the transaction manager
    public void setTransactionDefinition(TransactionDefinition transactionDefinition) {
        this. = transactionDefinition;
    }
New to GrepCode? Check out our FAQ X