Create an event subscription entry in the DB.
172834
protected function createSubscription(ProcessEngine $engine, ?Job $job = null): void
    {
        $execution = $engine->findExecution($this->executionId);
        $nodeId = ($this->nodeId === null) ? null : $execution->getProcessModel()->findNode($this->nodeId)->getId();
        
        $data = [
            'id' => UUID::createRandom(),
            'execution_id' => $execution->getId(),
            'activity_id' => $this->activityId,
            'node' => $nodeId,
            'process_instance_id' => $execution->getRootExecution()->getId(),
            'flags' => $this->getSubscriptionFlag(),
            'boundary' => $this->boundaryEvent ? 1 : 0,
            'name' => $this->name,
            'created_at' => \time()
        ];
        
        if ($job !== null) {
            $data['job_id'] = $job->getId();
        }
        
        $engine->getConnection()->insert('#__bpmn_event_subscription', $data);
    }
645858
def create(self):
        
        self.logger.debug('Create subscription on server...')

        if not self.connection.connected:
            self.state = 'connection_pending'
            return

        data = {
            'command': 'subscribe',
            'identifier': self._identifier_string()
        }

        self.connection.send(data)
        self.state = 'pending'
729770
def post(self, receiver_id=None):
        """"""
        try:
            user_id = request.oauth.access_token.user_id
        except AttributeError:
            user_id = current_user.get_id()

        event = Event.create(
            receiver_id=receiver_id,
            user_id=user_id
        )
        db.session.add(event)
        db.session.commit()

        # db.session.begin(subtransactions=True)
        event.process()
        db.session.commit()
        return make_response(event)
274504
public function createEntityEvent($event, $entityType, $entityId, array $properties = [], DateTime $eventTime = null)
    {
        $event = new EntityEvent($event, $entityType, $entityId);
        $event->setProperties($properties);
        $event->setEventTime($eventTime);
        $response = $this->createEvent($event->toArray());

        return $response;
    }
198243
def create_entry(self, title='', image=1, url='', username='', password='',
                      comment='', y=2999, mon=12, d=28, h=23, min_=59, s=59):
        

        return self.db.create_entry(self, title, image, url, username, 
                                    password, comment, y, mon, d, h, min_, s)
1112101
def organization_subscription_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/organization_subscriptions.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
545118
public static void register(Class<? extends Event> eventClass, Subscriber subscriber) {
        CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
        if (set == null) {
            set = new CopyOnWriteArraySet<Subscriber>();
            CopyOnWriteArraySet<Subscriber> old = SUBSCRIBER_MAP.putIfAbsent(eventClass, set);
            if (old != null) {
                set = old;
            }
        }
        set.add(subscriber);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Register subscriber: {} of event: {}.", subscriber, eventClass);
        }
    }
264647
function publishChanges (eventName, stateId) {
      var subscriptions = instanceSubscriptions[instanceId];

      if(!subscriptions) return;

      subscriptions.forEach(function (response) {
        response.write('event: ' + eventName +'\n');
        response.write('data: ' + stateId + '\n\n');
      });
    }
861833
private function doBeforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$dispatcher = $builder->getDefinition($this->prefix('dispatcher'));

		$subscribers = $builder->findByType(EventSubscriberInterface::class);
		foreach ($subscribers as $name => $subscriber) {
			$dispatcher->addSetup('addSubscriber', [$subscriber]);
		}
	}
1279109
public void subscribe(Class<? extends Event> eventType, Class<? extends Subscriber> subscriberType) {
        if (!subscriptionMap.containsKey(eventType)) {
            subscriptionMap.put(eventType, new ArrayList<>());
        }
        final ArrayList<Class<? extends Subscriber>> subscribers = subscriptionMap.get(eventType);
        if (!subscribers.contains(subscriberType)) {
            subscribers.add(subscriberType);
        }
    }
726536
public static DataStoreEvent insertionEvent(DBIDs inserts) {
    return new DataStoreEvent(inserts, DBIDUtil.EMPTYDBIDS, DBIDUtil.EMPTYDBIDS);
  }
1211892
def _insert(self, namespace, stream, events, configuration):
    
    max_items = configuration['max_items']
    for _id, event in events:
      while len(self.db[namespace][stream]) >= max_items:
        self.db[namespace][stream].pop(0)
      bisect.insort(self.db[namespace][stream], Event(_id, event))
366430
def subscribe(self, handler):
        """"""
        assert callable(handler), "Invalid handler %s" % handler
        self.handlers.append(handler)
656256
def WriteEventBody(self, event):
    
    if not hasattr(event, 'timestamp'):
      return

    row = self._GetSanitizedEventValues(event)
    try:
      self._cursor.execute(self._INSERT_QUERY, row)
    except MySQLdb.Error as exception:
      logger.warning(
          'Unable to insert into database with error: {0!s}.'.format(
              exception))

    self._count += 1

    # TODO: Experiment if committing the current transaction
    # every 10000 inserts is the optimal approach.
    if self._count % 10000 == 0:
      self._connection.commit()
      if self._set_status:
        self._set_status('Inserting event: {0:d}'.format(self._count))
1186683
def subscribe( event, handler )

      @events = %w{ onSendRequest onProcessResponse onSetActiveTable
                    onRequestSucceeded onRequestFailed onSetActiveRecord
                    onSetActiveField } if @events.nil?

      if @events.include?( event )
         if handler and handler.is_a?( EventHandler )
            if @eventSubscribers.nil?
               @eventSubscribers = {}
            end
            if not @eventSubscribers.include?( event )
               @eventSubscribers[ event ] = []
            end
            if not @eventSubscribers[ event ].include?( handler )
               @eventSubscribers[ event ] << handler
            end
         else
            raise "subscribe: 'handler' must be a class derived from QuickBase::EventHandler."
         end
      else
         raise "subscribe: invalid event '#{event}'.  Valid events are #{@events.sort.join( ', ' )}."
      end
   end
1048726
def vip_create_event(self, vip_info):
        """"""
        vip_data = vip_info.get('vip')
        port_id = vip_data.get('port_id')
        vip_id = vip_data.get('id')
        self.add_lbaas_port(port_id, vip_id)
875309
def subscribe_to_events(config, subscriber, events, model=None):
    
    kwargs = {}
    if model is not None:
        kwargs['model'] = model

    for evt in events:
        config.add_subscriber(subscriber, evt, **kwargs)