Gradle
implementation("org.veupathdb.lib:rabbit-job-queue:1.0.0")
Java
var client = new QueueWorker(new QueueConfig());
client.onJob(job -> {
// Do some work here.
if (success)
client.sendSuccess(new SuccessNotification(job.getJobID()));
else
client.sendError(new ErrorNotification(job.getJobID(), errorCode));
});
Kotlin
val client = QueueWorker {}
client.onJob {
// Do some work here.
if (success)
client.sendSuccess(SuccessNotification(it.jobID))
else
client.sendError(ErrorNotification(it.jobID, errorCode))
}
Java
var dispatch = new QueueDispatcher(new QueueConfig());
dispatch.onSuccess(msg -> {
// Do something with the job success
});
dispatch.onError(err -> {
// Do something with the job error
});
dispatch.dispatch(new JobDispatch(
someJobID,
"jobType",
body
));
Kotlin
val dispatch = QueueDispatcher {}
dispatch.onSuccess {
// Do something with the job success
}
dispatch.onError {
// Do something with the job error
}
dispatch.dispatch(JobDispatch(
someJobID,
"jobType",
body
))