const P = require('bluebird');
const preq = require('preq');
const uuid = require('cassandra-uuid').TimeUuid;

function getResourceChangeEvent(resourceUri, domain) {
  return {
    meta: {
      topic: 'resource_change',
      uri: resourceUri,
      id: uuid.now().toString(),
      dt: new Date().toISOString(),
      domain,
    },
    tags: ['tilerator'],
  };
}

class EventService {
  constructor(eventBusUri, domain, sources, logger) {
    this.eventBusUri = eventBusUri;
    this.domain = domain;
    this.sources = sources;
    this.logger = logger;

    this.emitEvents = (events) => {
      P.try(() => preq.post({
        uri: this.eventBusUri,
        headers: { 'content-type': 'application/json' },
        body: events,
      })).catch(e => this.logger.log('error/events/emit', e)).thenReturn({ status: 200 });
    };

    // eslint-disable-next-line max-len
    this.emitResourceChangeEvents = uris => this.emitEvents(uris.map(uri => getResourceChangeEvent(uri, this.domain)));

    this.notifyTileChanged = (z, x, y) => {
      this.emitResourceChangeEvents(this.sources.map(s => `//${this.domain}/${s}/${z}/${x}/${y}.png`));
    };
  }
}

module.exports = EventService;

@@ -432,16 +432,36 @@
 , logger
+, protocol = 'https'
 ) %7B%0A    
@@ -571,16 +571,46 @@
  logger;
+%0A    this.protocol = protocol;
 %0A%0A    th
@@ -1142,16 +1142,33 @@
 p(s =%3E %60
+$%7Bthis.protocol%7D:
 //$%7Bthis

Add protocol to resource_change event URIs