Plain producer.
Multiple plain producers can publish to a single plain consumer.
Init example:
const iamqp = require('iamqp');
const amqpUri = 'amqp://localhost';
const channel = 'amqp-channel-b';
let plainProducer = new iamqp.PlainProducer(amqpUri, channel);
// This needs to be done or the errors will bubble up.
plainProducer.getEventer().on('error', (err) => {
console.log('producer error:' + err.message);
});
// For when the connection is established.
plainProducer.getEventer().on('connected', () => {
console.log('producer connected');
});
// Open the connection - this takes some time and is not sync
plainProducer.openConnection();
// Publish a single message.
let isPublishing = plainProducer.publish({
'a': 3
});
// Close the connection
if (plainProducer.closeConnection()) {
console.log('producer connection closing ...');
}
...