Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@coolgk/amqp
Advanced tools
a simple RabbitMQ (amqp wrapper) class for publishing and consuming messages
a javascript / typescript module
npm install @coolgk/amqp
a simple RabbitMQ (amqp wrapper) class for publishing and consuming messages
import { Amqp } from '@coolgk/amqp';
// OR
// const { Amqp } = require('@coolgk/amqp');
const amqp = new Amqp({
url: 'amqp://localhost/vhost'
});
const message = {
a: 1,
b: 'b'
};
// CONSUMER MUST BE STARTED FIRST BEFORE PUSHLISHING ANY MESSAGE
// consumer.js
// consume message and return (send) a response back to publisher
amqp.consume(({rawMessage, message}) => {
console.log('consumer received', message); // consumer received ignore response
// consumer received { a: 1, b: 'b' }
return {
response: 'response message'
}
});
// publisher.js
// publish a message, no response from consumer
amqp.publish('ignore response');
// publish a message and handle response from consumer
amqp.publish(message, ({rawResponseMessage, responseMessage}) => {
console.log('response from consumer', responseMessage); // response from consumer { response: 'response message' }
});
Kind: global class
void
promise.<Array.<boolean>>
promise
promise
Param | Type | Description |
---|---|---|
options | object | |
options.url | string | connection string e.g. amqp://localhost |
[options.sslPem] | string | pem file path |
[options.sslCa] | string | sslCa file path |
[options.sslPass] | string | password |
void
Kind: instance method of Amqp
promise.<Array.<boolean>>
Kind: instance method of Amqp
Param | Type | Default | Description |
---|---|---|---|
message | * | message any type that can be JSON.stringify'ed | |
[callback] | function | callback(message) for processing response from consumers | |
[options] | object | ||
[options.routes] | string | Array.<string> | "['#']" | route names |
[options.exchangeName] | string | "'defaultExchange'" | exchange name |
promise
Kind: instance method of Amqp
Param | Type | Default | Description |
---|---|---|---|
callback | function | consumer(message) function should returns a promise | |
[options] | object | ||
[options.routes] | string | Array.<string> | "['#']" | exchange routes |
[options.queueName] | string | "''" | queue name for processing messages. consumers with the same queue name process messages in round robin style |
[options.exchangeName] | string | "'defaultExchange'" | exchange name |
[options.exchangeType] | string | "'topic'" | exchange type |
[options.priority] | number | 0 | priority, larger numbers indicate higher priority |
[options.prefetch] | number | 1 | 1 or 0, if to process request one at a time |
promise
Kind: instance method of Amqp
Returns: promise
- - promise
FAQs
a simple RabbitMQ (amqp wrapper) class for publishing and consuming messages
The npm package @coolgk/amqp receives a total of 7 weekly downloads. As such, @coolgk/amqp popularity was classified as not popular.
We found that @coolgk/amqp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.