index.js
function(callback) {
    bootstrap(behaviour, (bootstrapErr, bootstrapRes) => {
      if (bootstrapErr) api.emit("error", bootstrapErr);
      if (bootstrapRes && bootstrapRes.virgin) {
        bootstrapRes.connection.on("error", (err) => api.emit("error", err));
        bootstrapRes.connection.on("close", (why) => api.emit("error", why));
        api.emit("connected");
        bootstrapRes.pubChannel.on("error", (err) => api.emit("error", err));
        bootstrapRes.subChannel.on("error", (err) => api.emit("error", err));
        bootstrapRes.pubChannel.assertExchange(behaviour.exchange, "topic");
      }
      callback(bootstrapErr, bootstrapRes);
    });
  }
function(callback) {
    bootstrap(behaviour, (bootstrapErr, bootstrapRes) => {
      if (bootstrapErr) api.emit("error", bootstrapErr);
      if (bootstrapRes && bootstrapRes.virgin) {
        bootstrapRes.connection.on("error", (err) => api.emit("error", err));
        bootstrapRes.connection.on("close", (why) => api.emit("error", why));
        api.emit("connected");
        bootstrapRes.pubChannel.on("error", (err) => api.emit("error", err));
        bootstrapRes.subChannel.on("error", (err) => api.emit("error", err));
        bootstrapRes.pubChannel.assertExchange(behaviour.exchange, "topic");
      }
      callback(bootstrapErr, bootstrapRes);
    });
  }
function ( callback ) { bootstrap ( behaviour , ( bootstrapErr , bootstrapRes ) => { if ( bootstrapErr ) api . emit ( "error" , bootstrapErr ) ; if ( bootstrapRes && bootstrapRes . virgin ) { bootstrapRes . connection . on ( "error" , ( err ) => api . emit ( "error" , err ) ) ; bootstrapRes . connection . on ( "close" , ( why ) => api . emit ( "error" , why ) ) ; api . emit ( "connected" ) ; bootstrapRes . pubChannel . on ( "error" , ( err ) => api . emit ( "error" , err ) ) ; bootstrapRes . subChannel . on ( "error" , ( err ) => api . emit ( "error" , err ) ) ; bootstrapRes . pubChannel . assertExchange ( behaviour . exchange , "topic" ) ; } callback ( bootstrapErr , bootstrapRes ) ; } ) ; }
get connnection and add event listeners if it's brand new.
get connnection and add event listeners if it s brand new .