Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to list all tasks in a Queue #14

Closed
RicardoVaranda opened this issue Jun 9, 2016 · 2 comments
Closed

Ability to list all tasks in a Queue #14

RicardoVaranda opened this issue Jun 9, 2016 · 2 comments

Comments

@RicardoVaranda
Copy link

Just wondering if this feature is available as it is not documented, if not could you please point out how this could be achieved.

@mpneuried mpneuried self-assigned this Jun 20, 2016
@mpneuried
Copy link
Owner

Hi,
because rsmq ist a QUEUE it makes no sense to be able to list all tasks/messages.

The only way to get all messages is to receive them all.

But you can get it the count of messages (rsmq.getQueueAttributes) and some other information directly from the internal rsmq instance with the following code:

var QUEUENAME = "myqueue";

var RSMQWorker = require( "rsmq-worker" );
var worker = new RSMQWorker( QUEUENAME );

worker.queue.getQueueAttributes( {qname: QUEUENAME}, function( err, info ){
  if( err ){
    throw( err )
    return
  }
  console.log( "Message count:", info.msgs ) 
});

I added a TODO #17 to short cut the worker.queue.getQueueAttributes to a simple worker.info().

@mpneuried
Copy link
Owner

With Version 0.5.0 i added the methods .info() and .size()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants