amqp-to-mongo
save RabbitMQ messages to MongoDB collection
Last updated 4 years ago by typeduck .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install amqp-to-mongo -g
SYNC missed versions from official npm registry.

AMQP to MongoDB

amqp-to-mongo consumes AMQP messages from one or more queues, and saves them to a MongoDB collection.

Usage and Configuration

Queue names to consume are given on the command line.

amqp-to-mongo queue-name [queue-name...]

Other behaviour is affected via the following environment variables:

  • AMQPHOST: AMQP Server URL (default: amqp://guest:guest@localhost)
  • MONGODB: MongoDB Database URL (default: mongodb://localhost/amqp)
  • MONGOCOLLECTION: Database collection to save to (default: messages)
  • TRANSLATECONTENT: translate content field (default: true)
  • REQUEUEERRORS: MongoDB errors rejected w/ requeue option (default: false)

WARNING: If you set REQUEUEERRORS=true, the message could be redelivered, possibly resulting in a loop! Drink this option responsibly!

Data Structures

The data structures are saved as consumed by amqplib, with a little extra:

  • date: new Date instance at moment of consumption
  • queue: name of AMQP Queue on which message arrived
  • fields: non-empty (null/undefined) values from amqplib
  • properties: non-empty (null/undefined) values from amqplib
  • content: content from amqplib, possibly translated

The date is intended to allow you to set a TTL index, or just to keep track of when the message was consumed (although the ObjectId can do this, too).

The queue is added so you can remember where the object came from, although routing info is also included in the fields from amqplib.

Content Translation

Content translation of the content field occurs prior to saving unless TRANSLATECONTENT is turned off. When turned off, the messages are saved as binary types.

If the AMQP message properties content-type and/or content-encoding are specified, the content will be translated.

  • application/json is parsed into JSON object
  • text/* is read as a string
  • everything else is saved as a string, encoded in ascii, base64, or utf-8, depending on content-encoding and whether possible to convert to utf-8

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

4 Versions

  • 1.0.0                                ...           4 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (0)
None
Dependents (3)

Copyright 2014 - 2017 © taobao.org |