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

io.vertx.up.unity.UxJob Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.unity;

import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;
import io.vertx.tp.plugin.job.JobClient;
import io.vertx.tp.plugin.job.JobInfix;
import io.vertx.up.fn.Fn;
import io.vertx.up.log.Annal;

public class UxJob {
    private static final Annal LOGGER = Annal.get(UxJob.class);
    private transient final JobClient client;

    UxJob() {
        this.client = JobInfix.getClient();
    }

    // Start job
    public Future startAsync(final String code) {
        return Fn.thenGeneric(future -> this.client.startAsync(code, res -> {
            LOGGER.info(Info.JOB_START, code, res.result());
            future.complete(Boolean.TRUE);
        }));
    }

    // Stop job
    public Future stopAsync(final String code) {
        return Fn.thenGeneric(future -> this.client.stopAsync(code,
            res -> {
                LOGGER.info(Info.JOB_STOP, code);
                future.complete(Boolean.TRUE);
            }));
    }

    // Resume job
    public Future resumeAsync(final String code) {
        return Fn.thenGeneric(future -> this.client.resumeAsync(code,
            res -> {
                LOGGER.info(Info.JOB_RESUME, code);
                future.complete(Boolean.TRUE);
            }));
    }

    public Future statusAsync(final String namespace) {
        return this.client.statusAsync(namespace);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy