All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.otto.edison.jobs.service.JobRunnable Maven / Gradle / Ivy

There is a newer version: 3.3.2
Show newest version
package de.otto.edison.jobs.service;

import de.otto.edison.jobs.definition.JobDefinition;
import de.otto.edison.jobs.eventbus.JobEventPublisher;

/**
 * The executable part of a Job that is executing background tasks in Edison microservices.
 *
 * @author Guido Steinacker
 * @since 15.02.15
 */
public interface JobRunnable {

    /**
     * Returns the definition of the job, specifying when a job should be executed.
     *
     * @return JobDefinition
     */
    JobDefinition getJobDefinition();

    /**
     * Executes the background task of the job and updates the JobInfo during execution.
     *
     * @return false, if the job was skipped without doing anything, true otherwise
     */
    default boolean execute() {
        return true;
    }

    /**
     * Executes the background task of the job and updates the JobInfo during execution.
     * Inject JobEventPublisher to execute for backwards compatibility to branch 1.2.x
     *
     * @param jobEventPublisher publishes events to the event bus.
     * @return false, if the job was skipped without doing anything, true otherwise
     * @deprecated use execute, don't remove this method
     */
    @Deprecated
    default boolean execute(JobEventPublisher jobEventPublisher) {
        return execute();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy