Step 1 : create the application
Next Step : get the event H2H
482199
public void callServerH2H() {
        if(CoreEngine.getInstance().getConfig().getToken() == null){
            System.out.println("Call init Token");
            ThunderExporterService.getInstance().registerAppInThunder();
        }else{
            MessageEvent me = new MessageEvent();
            me.setToken(CoreEngine.getInstance().getConfig().getToken());
            me.setReference(CoreEngine.getInstance().getConfig().getReference());
            String result = ThunderExporterService.getInstance().sendDataHTTPOldSchool("/event",me);
            System.out.println("Result on /event "+result);
            Gson gson = new Gson();
            try {
                Type typeList = new TypeToken<ArrayList<MessageEvent>>() {}.getType();
                List<MessageEvent> listEvent = gson.fromJson(result, typeList);
                for(MessageEvent meResult : listEvent) {
                    System.out.println("MessageEvent "+meResult.toString());
                    switch (meResult.getTypeMessageEvent()) {
                        case INIT_PATH:
                            CoreEngine.getInstance().initPathsRemote();
                            break;
                        case ENABLE_ENTRY_POINT:
                            enableEntryPoint(meResult);
                            break;
                        default:
                            throw new IllegalStateException(meResult.getTypeMessageEvent() + " is not supported");
                    }
                }

            }catch (JsonParseException e){
                System.err.println("Error on /event with token "+CoreEngine.getInstance().getConfig().getToken()+" and reference "+CoreEngine.getInstance().getConfig().getReference());
            }
        }
    }
741235
def step(self) -> None:
        
        event = heappop(self._events)
        self._ts_now = event.timestamp or self._ts_now
        event.execute(self)
95598
def create_event(*args)
      raise "EventCampaign needs to be saved before Event creation" if self.id.nil?

      (args[0]).merge!(:campaign_id => self.id)

      event = ActionKitApi::Event.new(*args)
    end
431089
function EventsBus() {
    var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    classCallCheck(this, EventsBus);

    this.events = events;
    this.hop = events.hasOwnProperty;
  }
522999
function createApi(projectInfo, awsDetails, callback) {
    return appsyncCreate.run(projectInfo, awsDetails).then(()=>{
        if(callback){
            callback()
        }
    })
}
135391
function() {
			if (this.events) { return; }

			var tag		= this.tag,
				script	= this,
				prefix	= '',
				method	= 'addEventListener';

			// The alternative is nuking Redmond from orbit, its the only way to
			// be sure...
			if (!tag.addEventListener) {
				prefix = 'on';
				method = 'attachEvent';
			}

			function loaded(event) {
				script.onload();
			}

			function failed(event) {
				script.onfail();
			}

			function state(event) {
				switch(tag.readyState) {
					case 'complete':	return loaded(event);
					case 'error':		return failed(event);
				}
			}

			if (prefix === '') {
				tag[method](prefix + 'error', failed);
				tag[method](prefix + 'load', loaded);
			}else{
				tag[method](prefix + 'readystatechange', state);
			}

			this.events = {
				loaded:	loaded,
				failed:	failed,
				state:	state
			};

			return this;
		}
13020
def on_created(self, event):
        ''''''
        if self.trigger != "create":
            return
        action_input = ActionInput(event, "", self.name)
        flows.Global.MESSAGE_DISPATCHER.send_message(action_input)
916800
function (callback) {
    var self = this;

    function initDispatcher() {
      debug('init event dispatcher');
      self.dispatcher = new EventDispatcher(self.publisher, self);
      self.dispatcher.start(callback);
    }

    this.store.on('connect', function () {
      self.emit('connect');
    });

    this.store.on('disconnect', function () {
      self.emit('disconnect');
    });

    process.nextTick(function() {
      tolerate(function(callback) {
        self.store.connect(callback);
      }, self.options.timeout || 0, function (err) {
        if (err) {
          debug(err);
          if (callback) callback(err);
          return;
        }
        if (!self.publisher) {
          debug('no publisher defined');
          if (callback) callback(null);
          return;
        }
        initDispatcher();
      });
    });
  }
765442
void performPostCreationTasks()
    {
        StatusAction statusAction = new StatusAction();
        try
        {
            ResponseEvents events = CoherentManagerConnection.sendEventGeneratingAction(statusAction, 1000);
            for (ResponseEvent event : events.getEvents())
            {
                if (event instanceof StatusEvent)
                {
                    // do nothing. Creating the events will register the
                    // channels, which is after all what we are trying to do.
                }
            }

        }
        catch (IllegalArgumentException | IllegalStateException | IOException | TimeoutException e)
        {
            logger.error(e, e);
        }

    }
581499
def _get_stack_events(h_client, stack_id, event_args):
    '''
    
    '''
    event_args['stack_id'] = stack_id
    event_args['resource_name'] = None
    try:
        events = h_client.events.list(**event_args)
    except heatclient.exc.HTTPNotFound as exc:
        raise heatclient.exc.CommandError(six.text_type(exc))
    else:
        for event in events:
            event.stack_name = stack_id.split('/')[0]
        return events
1337952
function (callback, initialHash) {

            var self = this,
                fragment;

            this.$checkUrlFn = function () {
                self.checkUrl.apply(self, arguments);
            };

            if (this.runsInBrowser()) {
                // we're in a browser

                if (this.$.useState) {

                    fragment = window.location.pathname;
                    fragment = fragment.replace(new RegExp("^" + (this.$.baseUrl || "")), "");

                    if (window.addEventListener) {
                        window.addEventListener('popstate', this.$checkUrlFn, false);
                    } else {
                        window.attachEvent('onpopstate', this.$checkUrlFn);
                    }

                } else {

                    if ("onhashchange" in window) {
                        if (window.addEventListener) {
                            window.addEventListener('hashchange', this.$checkUrlFn, false);
                        } else {
                            window.attachEvent('onhashchange', this.$checkUrlFn);
                        }
                    } else {
                        // polling
                        this.$checkUrlInterval = setInterval(this.$checkUrlFn, this.$.interval);
                    }
                }


            } else {
                // rendering on node
                this.$history.push(initialHash || "");
            }

            fragment = fragment || this._getFragment();

            this.navigate(fragment, false, true, true, callback);
            this.$processUrl = true;
        }
458349
function event()
    {
        if (! $this->events ) {
            $events = new EventHeapOfSapi;
            $events->setMeeter( new MeeterIoc );

            $this->events = $events;
        }


        $this->events->collector()->setSapi($this); // also failure events need sapi
        return $this->events;
    }
1349144
function createServer() {
  function app(req, res, next) {
    app.handle(req, res, next);
  }
  app.method = '*';
  merge(app, proto);
  merge(app, EventEmitter.prototype);
  app.stack = [];
  app.params = [];
  app._cachedEvents = [] ;
  app.routedMethods = {} ;
  app.locals = Object.create(null);
  for (var i = 0; i < arguments.length; ++i) {
    app.use(arguments[i]);
  }

  //create methods app.invite, app.register, etc..
  methods.forEach((method) => {
    app[method.toLowerCase()] = app.use.bind(app, method.toLowerCase()) ;
  }) ;

  //special handling for cdr events
  app.on = function(event, listener) {
    if (0 === event.indexOf('cdr:')) {
      if (app.client) {
        app.client.on(event, function() {
          var args = Array.prototype.slice.call(arguments) ;
          EventEmitter.prototype.emit.apply(app, [event].concat(args)) ;
        }) ;
      }
      else {
        this._cachedEvents.push(event) ;
      }
    }
    //delegate all others to standard EventEmitter prototype
    return EventEmitter.prototype.addListener.call(app, event, listener) ;
  } ;

  return app;
}
789074
def deploy(project_name):
    """"""
    request_log = requestlog.RequestLog
    header_addon = HeaderControl
    fault_wrapper = FaultWrapper
    application = handler.SdkHandler()

    # currently we have 3 middleware
    for middleware in (header_addon,
                       fault_wrapper,
                       request_log,
                       ):
        if middleware:
            application = middleware(application)

    return application
1091140
function(e) {
		gui.Spirit.prototype.onevent.call(this, e);
		switch (e.type) {
			case 'message':
				this._onmessage(e.data, e.origin, e.source);
				break;
			case 'load':
				// now what?
				break;
		}
	}
1086795
def run(self, event):
        
        repo_id = event.payload['repository']['id']

        # Ping event - update the ping timestamp of the repository
        if 'hook_id' in event.payload and 'zen' in event.payload:
            repository = Repository.query.filter_by(
                github_id=repo_id
            ).one()
            repository.ping = datetime.utcnow()
            db.session.commit()
            return

        # Release event
        if 'release' in event.payload and \
                event.payload.get('action') == 'published':
            try:
                release = Release.create(event)
                db.session.commit()

                # FIXME: If we want to skip the processing, we should do it
                # here (eg. We're in the middle of a migration).
                # if current_app.config['GITHUB_PROCESS_RELEASES']:
                process_release.delay(
                    release.release_id,
                    verify_sender=self.verify_sender
                )
            except (ReleaseAlreadyReceivedError, RepositoryDisabledError) as e:
                event.response_code = 409
                event.response = dict(message=str(e), status=409)
            except RepositoryAccessError as e:
                event.response = 403
                event.response = dict(message=str(e), status=403)
323381
function subscribeToEvents() {
    const socket = _socket.get(this);

    function onEventApiError(error) {
        dbg('Event API connection error: ' + JSON.stringify(error));
    }

    socket.on('pong', (latency) => {
        dbg(`Event API latency: ${latency} ms`);
    });
    socket.on('connect_error', onEventApiError);
    socket.on('error', onEventApiError);
    socket.on('disconnect', onEventApiError);
    socket.on('reconnect_error', onEventApiError);
    socket.on('reconnect_failed', () => {
        onEventApiError('Reconnecting to the Event API failed');
    });

    socket.on('new_receipt', receiptJSON => {
        const receipt = Receipt.from(receiptJSON, _provider.get(this));
        _eventEmitter.get(this).emit(EventNames.newReceipt, receipt);
    });
}