Gradle
implementation("org.veupathdb.lib:rabbit-job-queue:2.0.1")
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
))
- Message Ack Timeouts
-
RabbitMQ allows channels to be configured with their own timeout values, however these values cannot exceed the
consumer_timeout
value set inrabbitmq.conf
file. By default, theconsumer_timeout
value is undefined, meaning channels can specify any timeout they choose, but care must be taken if configuring the RabbitMQ globalconsumer_timeout
to ensure that any channel specific timeouts are shorter than the global value.