Scheduler

Modules

The scheduler service consists of the following modules:

Database

The scheduler service uses three tables:

Conflict Handler

The conflict handler implements a strategy to resolve conflicts by either using the new or the old schedule according the configuration.

Conflict Notifier

There are two implementations of a conflict notifier available and activated by default.

Default API

Here is a sample to create a single event with the scheduler Java API.

  public void createEvent(Event event) {
    schedulerService.addEvent(event.getStart(),
                              event.getEnd(),
                              event.getAgentId(),
                              event.getUsers(),
                              event.getMediaPackage(),
                              event.getWfProperties(),
                              event.getCaMetadata(),
                              event.getOptOut(),
                              event.getSource(),
                              "organization-xyz-script";
  }

Transactional API

Here is a simplified code example of how to use the Scheduler Java API to synchronize timetable events to scheduled events. It is mandatory that the media package identifier is stable for the created events of the timetable system.

  public void syncTimeTable(List<Event> timeTableEvents) {
    SchedulerTransaction tx = null;
    try {
      logger.info("Sync timetable to scheduler | start");
      tx = schedulerService.createTransaction("timetable");
      for (Event event : timeTableEvents) {
        tx.addEvent(
                event.getStart(),
                event.getEnd(),
                event.getAgentId(),
                event.getUsers(),
                event.getMediaPackage(),
                event.getWfProperties(),
                event.getCaMetadata(),
                event.getOptOut());
      }
      tx.commit();
      logger.info("Sync timetable to scheduler | end");
    } catch (Exception e) {
      logger.error("Sync timetable to scheduler | error\n{}", e);
      if (tx != null) {
        logger.error("Sync timetable to scheduler | rollback transaction");
        try {
          tx.rollback();
        } catch (Exception e2) {
          logger.error("Sync timetable to scheduler | error doing rollback\n{}", e2);
        }
      }
    }
  }