org.swisspush.redisques.handler.AddQueueItemHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redisques Show documentation
Show all versions of redisques Show documentation
A highly scalable redis-persistent queuing system for vertx
package org.swisspush.redisques.handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.eventbus.Message;
import io.vertx.core.json.JsonObject;
import io.vertx.redis.client.Response;
import org.slf4j.Logger;
import org.swisspush.redisques.exception.RedisQuesExceptionFactory;
import static org.slf4j.LoggerFactory.getLogger;
import static org.swisspush.redisques.util.RedisquesAPI.OK;
import static org.swisspush.redisques.util.RedisquesAPI.STATUS;
/**
* Class AddQueueItemHandler.
*
* @author baldim, Marc-André Weber
*/
public class AddQueueItemHandler implements Handler> {
private static final Logger log = getLogger(AddQueueItemHandler.class);
private final Message event;
private final RedisQuesExceptionFactory exceptionFactory;
public AddQueueItemHandler(Message event, RedisQuesExceptionFactory exceptionFactory) {
this.event = event;
this.exceptionFactory = exceptionFactory;
}
@Override
public void handle(AsyncResult reply) {
if(reply.succeeded()){
event.reply(new JsonObject().put(STATUS, OK));
} else {
event.reply(exceptionFactory.newReplyException(null, reply.cause()));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy