Skip to content
Viren edited this page Dec 13, 2016 · 3 revisions

DynoQueue API Docs

public String getName()

  • Returns: Returns the name of the queue

public int getUnackTime()

  • Returns: Time in milliseconds before the messages that are popped and not acknowledge are pushed back into the queue.
  • See also: ack(String)

public List<String> push(List<Message> messages)

  • Parameters: messages — messages to be pushed onto the queue
  • Returns: Returns the list of message ids

public List<Message> pop(int messageCount, int wait, TimeUnit unit)

  • Parameters:
    • messageCount — number of messages to be popped out of the queue.
    • wait — Amount of time to wait if there are no messages in queue
    • unit — Time unit for the wait period
  • Returns: messages. Can be less than the messageCount if there are fewer messages available than the message count. If the popped messages are not acknowledge in a timely manner, they are pushed back into the queue.
  • See also:
    • peek(int)

    • ack(String)

    • getUnackTime()

public List<Message> peek(int messageCount)

Provides a peek into the queue without taking messages out.

  • Parameters: messageCount — number of messages to be peeked.
  • Returns: List of peeked messages.
  • See also: pop(int, int, TimeUnit)

public boolean ack(String messageId)

Provides an acknowledgement for the message. Once ack'ed the message is removed from the queue forever.

  • Parameters: messageId — ID of the message to be acknowledged
  • Returns: true if the message was found pending acknowledgement and is now ack'ed. false if the message id is invalid or message is no longer present in the queue.

public boolean setUnackTimeout(String messageId, long timeout)

Sets the unack timeout on the message (changes the default timeout to the new value). Useful when extended lease is required for a message by consumer before sending ack.

  • Parameters:
    • messageId — ID of the message to be acknowledged
    • timeout — time in milliseconds for which the message will remain in un-ack state. If no ack is received after the timeout period has expired, the message is put back into the queue
  • Returns: true if the message id was found and updated with new timeout. false otherwise.

public boolean setTimeout(String messageId, long timeout)

Updates the timeout for the message.

  • Parameters:
    • messageId — ID of the message to be acknowledged
    • timeout — time in milliseconds for which the message will remain invisible and not popped out of the queue.
  • Returns: true if the message id was found and updated with new timeout. false otherwise.

public boolean remove(String messageId)

  • Parameters: messageId — Remove the message from the queue
  • Returns: true if the message id was found and removed. False otherwise.

public Message get(String messageId)

  • Parameters: messageId — message to be retrieved.
  • Returns: Retrieves the message stored in the queue by the messageId. Null if not found.

public long size()

  • Returns: Size of the queue.
  • See also: shardSizes()

public Map<String, Map<String, Long>> shardSizes()

  • Returns: Map of shard name to the # of messages in the shard.
  • See also: size()

public void clear()

Truncates the entire queue. Use with caution!