function Request(channel, options) {
  EventStream.call(this, channel, options);
  var self = this,
    replyQueueOptions = {exclusive: true, autoDelete: true, durable: false},
    consumeOptions = {noAck: false, exclusive: true, durable: false};
  this.replyQueue = null;
  // setup reply queue
  this.createQueue('', replyQueueOptions, function (ok, channel) {
    self.replyQueue = ok.queue;
    // start consuming messages from the reply queue
    return channel.consume(ok.queue, function (msg) {
      var event = EventStream.convertToEvent(msg);
      self.emit('message.' + event.options.properties.correlationId, event, function () {
        channel.ack(msg);
      });
    }, consumeOptions);
  });
}
/**
 * Request class to handle sending a message to one client and wait for a reply.
 * The request event stream creates a queue for any incoming messages and emits
 * a "message.<correlationId>" for any received message.
 * @param channel
 * @param options Can have the following options: prefetch, expiration, persistent, topic, task
 * @constructor
 */
Request class to handle sending a message to one client and wait for a reply.
The request event stream creates a queue for any incoming messages and emits
a "message." for any received message.
@param channel
@param options Can have the following options: prefetch, expiration, persistent, topic, task
@constructor
Request class to handle sending a message to one client and wait for a reply . The request event stream creates a queue for any incoming messages and emits a " message . " for any received message . @param channel @param options Can have the following options : prefetch expiration persistent topic task @constructor
function Request(channel, options) {
  EventStream.call(this, channel, options);
  var self = this,
    replyQueueOptions = {exclusive: true, autoDelete: true, durable: false},
    consumeOptions = {noAck: false, exclusive: true, durable: false};
  this.replyQueue = null;
  this.createQueue('', replyQueueOptions, function (ok, channel) {
    self.replyQueue = ok.queue;
    return channel.consume(ok.queue, function (msg) {
      var event = EventStream.convertToEvent(msg);
      self.emit('message.' + event.options.properties.correlationId, event, function () {
        channel.ack(msg);
      });
    }, consumeOptions);
  });
}
function Request ( channel , options ) { EventStream . call ( this , channel , options ) ; var self = this , replyQueueOptions = { exclusive : true , autoDelete : true , durable : false } , consumeOptions = { noAck : false , exclusive : true , durable : false } ; this . replyQueue = null ; this . createQueue ( '' , replyQueueOptions , function ( ok , channel ) { self . replyQueue = ok . queue ; return channel . consume ( ok . queue , function ( msg ) { var event = EventStream . convertToEvent ( msg ) ; self . emit ( 'message.' + event . options . properties . correlationId , event , function ( ) { channel . ack ( msg ) ; } ) ; } , consumeOptions ) ; } ) ; }
Request class to handle sending a message to one client and wait for a reply.
Request class to handle sending a message to one client and wait for a reply .
// setup reply queue // start consuming messages from the reply queue