![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
This package provides AMQP integration for Sand applications. It wraps @sazze/amqp.
npm install --save sand-amqp
The Publisher
and Consumer
classes wrap their respective objects from @sazze/amqp. They automatically handle connectivity upon instantiation, and clean disconnection on application shutdown. The ready
event is raised when connectivity is established.
To instantiate a new Publisher
instance, call sand.amqp.startPublisher(config, name)
.
Configuration options are available here; they are defaulted by the amqp
values in your application's config/amqp.js
file.
If name
is provided, the publisher will be available via the sand.amqp.publishers
object.
In addition to the publisher options there is also autoConnect
, which defaults to true and determines whether or not to auto connect on instantiation.
To instantiate a new Consumer
instance, call sand.amqp.startConsumer(config, name)
.
Configuration options are available here; they are defaulted by the amqp
values in your application's config/amqp.js
file. If a handler
function is provided as an option, it is invoked when a message is received. handler
may be a regular function or a generator function.
If name
is provided, the consumer will be available via the sand.amqp.consumers
object.
In addition to the consumer options, specific to this library there is also autoStart
, which defaults to true and determines whether or not the consumer starts on instantiation. There is also runInSandContext
which defaults to true. If TRUE then the handler
function runs inside a sand context.
If autoStart
is set in the configuration, sand-amqp
will automatically instantiate any publisher and consumer configurations stored in the publisherDir
and consumerDir
directories. This is useful if you want publishers and consumers to automatically start and persist throughout the lifetime of your application.
publisherDir
and consumerDir
values should be relative to your Sand application path.
This example Sand application will connect to the local AMQP instance and publish the string hello world
to the demo
exchange once per second.
config/amqp.js:
"use strict";
module.exports = {
all: {
amqp: {
host: '127.0.0.1',
port: 5672,
user: 'guest',
password: 'guest',
vhost: '/',
ssl: {
enable: false
}
}
}
};
app.js:
"use strict";
const Sand = require('sand');
const amqp = require('sand-amqp');
new Sand({ appPath: __dirname })
.use(amqp)
.start(function*() {
sand.amqp.startConsumer({
exchange: {
name: 'demo',
type: 'direct'
},
handler: (msg) => console.log(msg)
});
let publisher = sand.amqp.startPublisher({
exchange: {
name: 'demo',
type: 'direct'
}
});
setInterval(function() {
publisher.publish('hello world');
}, 1000);
});
Output:
hello world
hello world
hello world
Note: A running AMQP instance is required for tests to pass. You may need to adjust test/fixtures/config/test.js
for your environment.
To test, run npm test
from the project root directory.
ISC
FAQs
Sand AMQP Library
The npm package sand-amqp receives a total of 1 weekly downloads. As such, sand-amqp popularity was classified as not popular.
We found that sand-amqp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.