Class RedisDB

java.lang.Object
io.vertigo.stella.plugins.work.redis.RedisDB

public final class RedisDB extends Object
Author:
pchretien, npiedeloup
  • Constructor Details

    • RedisDB

      public RedisDB(int timeoutSeconds, io.vertigo.commons.codec.CodecManager codecManager, io.vertigo.connectors.redis.RedisConnector redisConnector)
      Constructor.
      Parameters:
      codecManager - the codecManager
      redisConnector - the redis connector
  • Method Details

    • reset

      public void reset()
    • putStart

      public void putStart(String nodeId, String workType, String workId)
      Parameters:
      nodeId - Worker node id
      workType - Work type
      workId - Work Id
    • putWorkItem

      public <R, W> void putWorkItem(WorkItem<R,W> workItem)
      Puts a workitem in the todo list.
      Parameters:
      workItem - the workItem
    • pollWorkItem

      public <R, W> WorkItem<R,W> pollWorkItem(String nodeId, String workType)
      Polls a workitem from the todo list.
      Parameters:
      workType - the type of workItem
      Returns:
      null or a workitem
    • putResult

      public <R> void putResult(String callerNodeId, String nodeId, String workType, String workId, R result, Throwable error)
      Puts the result for a workitem identified by an id.
      Parameters:
      workId - the id of the workitem
      result - the result
      error - if an error occurred
    • pollResult

      public <R> WorkResult<R> pollResult(String callerNodeId, Set<String> workTypes)
    • heartBeat

      public void heartBeat(String nodeId, Set<String> workTypes)
    • checkDeadNodes

      public io.vertigo.core.lang.Tuple<Set<String>,Set<String>> checkDeadNodes(int maxRetry, Set<String> workTypes)
      Vérifie les noeuds morts, et si oui remets les workItems dans la pile. Could be executed concurrently by other Master.
      Parameters:
      maxRetry - number of retry before cancel work @TODO
      workTypes - to checks
      Returns:
      List of retried and canceled workId