implementation("org.veupathdb.lib:rabbit-job-queue:2.0.1")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));
});val client = QueueWorker {}
client.onJob {
// Do some work here.
if (success)
client.sendSuccess(SuccessNotification(it.jobID))
else
client.sendError(ErrorNotification(it.jobID, errorCode))
}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
));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
))- Message Ack Timeouts
-
RabbitMQ allows channels to be configured with their own timeout values, however these values cannot exceed the
consumer_timeoutvalue set inrabbitmq.conffile. By default, theconsumer_timeoutvalue is undefined, meaning channels can specify any timeout they choose, but care must be taken if configuring the RabbitMQ globalconsumer_timeoutto ensure that any channel specific timeouts are shorter than the global value.