@elastic.io/amqp-rpc
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "@elastic.io/amqp-rpc", | ||
"description": "RPC over RabbitMQ for Node.js", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"homepage": "http://elastic.io", | ||
@@ -6,0 +6,0 @@ "author": "elastic.io GmbH <info@elastic.io>", |
@@ -38,8 +38,9 @@ const assert = require('assert'); | ||
this._channel = await this._connection.createChannel(); | ||
this._queue = await this._channel.assertQueue(this._queueName, { | ||
autoDelete: true, | ||
durabale: true | ||
const queue = await this._channel.assertQueue(this._queueName, { | ||
durable: true | ||
}); | ||
this._channel.consume(this._queue.queue, this._handleMessage.bind(this)); | ||
return this._queue.queue; | ||
this._queueName = queue.queue; | ||
this._channel.consume(this._queueName, this._handleMessage.bind(this)); | ||
return this._queueName; | ||
} | ||
@@ -57,3 +58,3 @@ | ||
try { | ||
await channel.deleteQueue(this._queue.name); | ||
await channel.deleteQueue(this._queueName); | ||
} catch (e) { | ||
@@ -60,0 +61,0 @@ //it's ok to ignore this error, as queue |
@@ -28,8 +28,11 @@ const assert = require('assert'); | ||
describe('#contructor', () => { | ||
it('should set default queueName', () => { | ||
it('should be event emitter', () => { | ||
const receiver = new AMQPEventsReceiver(connectionStub); | ||
expect(receiver).to.be.instanceof(AMQPEventsReceiver); | ||
expect(receiver).to.be.instanceof(EventEmitter); | ||
}); | ||
it('should set connection', () => { | ||
const receiver = new AMQPEventsReceiver(connectionStub); | ||
expect(receiver._connection).to.equal(connectionStub); | ||
expect(receiver._queueName).to.equal(''); | ||
}); | ||
@@ -40,5 +43,2 @@ | ||
const receiver = new AMQPEventsReceiver(connectionStub, queueName); | ||
expect(receiver).to.be.instanceof(AMQPEventsReceiver); | ||
expect(receiver).to.be.instanceof(EventEmitter); | ||
expect(receiver._connection).to.equal(connectionStub, queueName); | ||
expect(receiver._queueName).to.equal(queueName); | ||
@@ -71,6 +71,6 @@ }); | ||
it('should create amqp queue with autoDelete and durable flags', async () => { | ||
it('should create amqp queue with options', async () => { | ||
const receiver = new AMQPEventsReceiver(connectionStub, 'q'); | ||
const queueStub = { | ||
queue: 'q' | ||
queue: 'q1' | ||
}; | ||
@@ -80,7 +80,6 @@ channelStub.assertQueue = sinon.stub().returns(Promise.resolve(queueStub)); | ||
expect(channelStub.assertQueue).to.have.been.calledOnce | ||
.and.calledWith(receiver._queueName, { | ||
autoDelete: true, | ||
durabale: true | ||
.and.calledWith('q', { | ||
durable: true | ||
}); | ||
expect(receiver._queue).to.equal(queueStub); | ||
expect(receiver._queueName).to.equal(queueStub.queue); | ||
expect(queueName).to.equal(queueStub.queue); | ||
@@ -87,0 +86,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57586
1459