Subscribe to a uri for events from a publisher
356590
def subscribe(self,topic,callback=None,options=None):
        
        full_topic = self.get_full_uri(topic)
        result = self.send_and_await_response(SUBSCRIBE(
                                    options=options or {},
                                    topic=full_topic
                                ))
        if result == WAMP_SUBSCRIBED:
            if not callback:
                callback = lambda a: None
            self._subscriptions[result.subscription_id] = [topic,callback]
732348
@Override
    public <T extends EventListener> void subscribe(EventPublisher source, T listener) {
	checkPermission();
	if (source == null || listener == null) {
	    throw new IllegalArgumentException("Parameters cannot be null");
	}
	super.subscribe(source, listener);
    }
164077
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo, String correlationId) {
        if (eventsPublisher != null) {
            eventsPublisher.publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
1266989
def publish_event(self, channel, event, message):
        '''
        '''
        assert self.protocol is not None, "Protocol required"
        msg = {'event': event, 'channel': channel}
        if message:
            msg['data'] = message
        return self.publish(channel, msg)
1240344
def publish(self):
        """"""

        while True:
            event = yield from self.event_source.get()
            str_buffer = []

            if event == POISON_PILL:
                return

            if isinstance(event, str):
                str_buffer.append(event)

            elif event.type == EventTypes.BLOCK_VALID:
                str_buffer = map(json.dumps, eventify_block(event.data))

            for str_item in str_buffer:
                for _, websocket in self.subscribers.items():
                    yield from websocket.send_str(str_item)
45900
def Publish(self, event_name, msg, delay=0):
    """"""
    events_lib.Events.PublishEvent(event_name, msg, delay=delay)
739174
function subscribe (obs, path, index, length, type, val, id, fire, origin, event, nocontext) {
  if (index === length) {
    // TODO added this to subscribe to key => this is probably not the best way to catch this
    if (obs.on) {
      obs.on('remove', function () {
        // null
        subscribe(origin, path, 0, length, type, val, id, false, origin, event)
      }, id, true, event, nocontext)
      obs.on(type, val, id, true, event, nocontext)
    }
    if (fire) {
      // **TODO** SUPER DIRTY
      // need to have some godamn arguments
      if (event === void 0) {
        var trigger = true
        event = new Event('data') // wrong
      }

      if (typeof val === 'function') {
        val.call(obs, obs.__input, event)
      } else {
        // weird gaurd
        if (val && val[0]) {
          val[0].call(obs, type === 'data' ? obs.__input : void 0, event, val[1])
        }
      }

      if (trigger) {
        event.trigger()
      }
    }
    return obs
  } else {
    let key = path[index]
    let property = obs[key]
    let result

    if (property && property.__input !== null) {
      result = subscribe(property, path, index + 1, length, type, val, id, fire, origin, event, nocontext)
    } else {
      let listenerType = key === 'parent' ? key : 'property'
      let listener = function (data, event) {
        let property = obs[key]
        if (property) {
          obs.off(listenerType, id, void 0, true)
          subscribe(property, path, index + 1, length, type, val, id, true, origin, event, nocontext)
        }
      }
      obs.on(listenerType, listener, id, true, event, nocontext)
    }

    // if sub is not fulfilled look in the reference
    if (!result) {
      let reference = ref(obs)
      if (reference) {
        subscribe(reference, path, index, length, type, val, id, fire, origin, event, nocontext)
      }
    }
  }
}
1215997
function subscribe(subscriber, immediate) {
        if (!~subscribers.indexOf(subscriber)) {
            subscribers.push(subscriber);
        }
        if (immediate) {
            subscriber(value);
        }
    }
593254
def send_event(properties)
      response = nil
      options = { use_ssl: true }
      Net::HTTP.start(@uri.host, @uri.port, options) do |http|
        request = Net::HTTP::Post.new(@uri, @header)
        request.body = { properties: properties }.to_json
        response = http.request request # Net::HTTPResponse object
      end
      response
    end
255683
public int subscribe_event(final DeviceProxy deviceProxy, final String attributeName,
	            final int event, final CallBack callback, final String[] filters,
	            final boolean stateless) throws DevFailed {
        int id = 0;
        try {
            id = EventConsumerUtil.getInstance().subscribe_event(deviceProxy,
                    attributeName.toLowerCase(), event, callback, filters, stateless);
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            e.printStackTrace();
            Except.throw_communication_failed(e.toString(), "Subscribe event on "
                + name(deviceProxy) + "/" + attributeName + " Failed !",
                "DeviceProxy.subscribe_event()");
        }
        return id;
    }
58577
def register_event(cls, event_name, event, method):
        
        log.info('@Registry.register_event `{}` with subscriber `{}`'
                 .format(event_name, method.__name__))

        if event_name not in cls._events:
            cls._events[event_name] = {}

        if event not in cls._events[event_name]:
            cls._events[event_name][event] = []

        cls._events[event_name][event].append(method)
457284
function publishPage(uri, publishMeta, user) {
  const NOW = new Date().toISOString(),
    update = {
      published: true,
      publishTime: NOW,
      history: [{ action: 'publish', timestamp: NOW, users: [userOrRobot(user)] }]
    };

  return changeMetaState(uri, Object.assign(publishMeta, update));
}
529029
@Async
    public void fireEventAsync(Object publisher, FireAfterTransactionAsynchronous events) throws Exception {
        for (int i = 0; i < events.events().length; i++) {
            Class<? extends EventObject> event = events.events()[i];
            if (RootApplicationEvent.class.isAssignableFrom(event)) {
                LOGGER.debug("Sending event: [{}]", event);
                ctx.publishEvent((RootApplicationEvent) event.getConstructor(Object.class).newInstance(publisher));
            }
        }
    }
483139
def initWithEventUriList(uriList):
        
        q = QueryEvents()
        assert isinstance(uriList, list), "uriList has to be a list of strings that represent event uris"
        q.queryParams = { "action": "getEvents", "eventUriList": ",".join(uriList) }
        return q
866306
def subscribe(self, name, params=[], callback=None):
        """"""
        self._wait_for_connect()

        def subscribed(error, sub_id):
            if error:
                self._remove_sub_by_id(sub_id)
                if callback:
                    callback(error.get('reason'))
                return
            if callback:
                callback(None)
            self.emit('subscribed', name)

        if name in self.subscriptions:
            raise MeteorClientException('Already subcribed to {}'.format(name))

        sub_id = self.ddp_client.subscribe(name, params, subscribed)
        self.subscriptions[name] = {
            'id': sub_id,
            'params': params
        }
46805
function publishUpdate(combo) {
    GLOBAL.svc.indexer.retrieveByURI(combo.uri, function(err, res) {
    if (!err && res && res._source) {
        res = res._source;
        combo.selector = 'body';
        combo.text = res.text;
        combo.content = res.content;
        fayeClient.publish('/item/annotations/annotate' + (combo.member ? '/' + combo.member.replace(/ /g, '_') : ''), combo);
        debounceUpdate(combo);
      } else {
        GLOBAL.error('not annotated', err, combo);
      }
    });
  }
862500
def subscribe(&blk)
      pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')
      connection.send_stanza pres, &blk
    end