Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
exp-amqp-connection
Advanced tools
This library is intended for doing simple publish and subscribe to an amqp broker.
Limitations:
Exposes a single function that boostraps a broker object, which in turn can be used for publishing and consuming messages. The connection will be re-established in case of errors.
For example:
const init = require("exp-amqp-connection");
const behaviour = {
exchange: "my-exchange",
url: "amqp://localhost"
};
const broker = init(behaviour);
broker.subscribeTmp("routingKey1", console.log);
broker.subscribeTmp("routingKey2", console.log);
broker.publish("routingKey1", "Msg 1");
broker.publish("routingKey1", "Msg 2");
// Delay delivery with 3000 ms using temporary exchange/queue-pair and dead-lettering.
broker.delayedPublish("routingKey2", "Msg 3", 3000);
The following options are accepted:
The broker object returned has the following functions. See the examples for more info on parameters etc.
Regular publish
Delayed publish using dead-letter-hack: https://www.cloudamqp.com/docs/delayed-messages.html
Subscribe using named durable queue.
If you need to wait for the subscription to start, use .on("subscribed", (sub) => ...)
Subscribe using nameless tmp queue. Queue will be destroyed when the broker disconnects.
If you need to wait for the subscription to start, use .on("subscribed", (sub) => ...)
Shuts down connection to broker.
By default one and only one connection is maintained for the entire process.
It is possible to add more by initializing with another configKey
.
For example:
const init = require("exp-amqp-connection");
const behaviour = {
exchange: "my-exchange",
url: "amqp://localhost",
configKey: "my-amqp"
};
// 1st connection
const broker = init(behaviour);
const otherBehaviour = {
url: "amqp://otherhost",
exchange: "other-exchange",
configKey: "other-amqp"
}
const broker2 = init(behaviour2)
FAQs
Wrapper for amqp lib that adds some nice features
The npm package exp-amqp-connection receives a total of 44 weekly downloads. As such, exp-amqp-connection popularity was classified as not popular.
We found that exp-amqp-connection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 18 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.