New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aedes-persistence-cassandra

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aedes-persistence-cassandra

Cassandra persistence for Aedes

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

aedes-persistence-cassandra

Aedes persistence, backed by Cassandra.

See aedes-persistence for the full API, and Aedes for usage.

Disclaimer

Be sure to understand applicability and limitations before using this package in production.

In most cases aedes-persistence-mongodb should be considered a better alternative to this.

Please understand that Cassandra is not suited for implementing queues as in most cases this results in reading lots of tombstones (cassandra-anti-patterns-queues-and-queue-datasets).

This package is suitable when:

  • You have a small sets of subscriptions with low traffic
  • You already have a deployed Cassandra cluster and can't afford to deploy another persistence solution (e.g. MongoDB or Redis)
  • You are regularly performing compactions/repair on the used keyspace

Install

npm install aedes aedes-persistence-cassandra --save

or

yarn add mqemitter-kafka aedes-persistence-cassandra

Target keyspace must be initialized with aedes.cql script.

API

AedesPersistenceCassandra([opts])

Creates a new instance of aedes-persistence-cassandra.

Options

  • ttl: Used to set a ttl (time to live) to documents stored in collections
    • packets: Could be an integer value that specify the ttl in seconds of all packets collections or an Object that specifies for each collection its ttl in seconds. Packets collections are: incoming, outgoing, retained, will.
    • susbscriptions: Set a ttl (in seconds)
  • cassandra: Extra options to pass to Cassandra driver (see cassandra-driver) (alternative to client)
  • client: Existing cassandra-driver client instance (alternative to cassandra)

If neither cassandra or client option are supplied, connection to localhost:9042 will be attempted with local datacenter datacenter1 and keyspace aedes.

Supplying an external client it's recommended.

Examples

const AedesPersistenceCassandra = require("aedes-persistence-cassandra");

AedesPersistenceCassandra({
  cassandra: { 
    contactPoints: ["localhost:9042"],
    localDataCenter: "datacenter1",
    keyspace: "aedes"
  },
  // Optional ttl settings
  ttl: {
      packets: 300, // Number of seconds
      subscriptions: 300,
  }
})

With the previous configuration all packets will have a ttl of 300 seconds. You can also provide different ttl settings for each packet type:

ttl: {
      packets: {
        incoming: 100,
        outgoing: 100,
        will: 300,
        retained: -1
      }, // Number of seconds
      subscriptions: 300,
}

If you want a specific packet type to be persistent just set corresponding ttl to null or undefined.

Acknowledgements

Implementation inspired after aedes-persistence-mongodb.

License

MIT

Keywords

FAQs

Package last updated on 13 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc