ironmq-queue-stream (WIP)
Tests
make test
Test coverage could be better.
Usage
IronStream = IronStream; var iron = projectId: "" projectToken: ""; //initialize a queue for that stream to pull fromvar queueOptions = ironmq: n: 100 timeout: THIRTY_MINUTES stream: highWaterMark: HIGHWATER_MARK ; var someQueueStream = iron; //pipe that stream to something usefulsomeQueueStream; /* The output of iron stream is the raw json pulled from the iron queue. Sometimes you want to reliably parse json that you stored on the queue to then process downstream. Say we stored a stringified json object on the queue like: '{ "some": "message" }' What's actually output from the ironmq queue is { "id": "123", "body": '{"some": "message"}' } Ironmq Stream provides a helper method to output a parsed json object, allowing the client to define an optional onError handler that executes when there's some parsing error.*/ var jsonParserOptions = { console; } stream: highWaterMark: HIGHWATER_MARK ; var parsedStream = IronStream; parsedStream;/* someOtherStream now gets { "id": "123", "some": "message" } The object is enriched with id in case you want to use a Queue sink downstream.*/
Sinks
/* Sometimes you might want to delete a message off IronMQ after doing some processing. Sinks make that easy.*/var Sink = Sink;var iron = projectId: "" projectToken: "";var myQueueStream = iron;var sink = myQueueStream deleteInBatchesOf: 100 stream: highWaterMark: HIGHWATER_MARK;myQueueStream; //every successful message is deleted from the queue.