Create invited timeline events.

@param EntityPublishedEvent $published_event The published event.

@return void
553576
public function createInvitationTimelineEntries(EntityPublishedEvent $published_event): void
    {
        // Only act on event objects.
        $event = $published_event->getObject();
        if (!$event instanceof Event) {
            return;
        }

        // Get the author for the event.
        $author = $this->user_provider->loadUserByUsername($event->getAuthor());

        // Create components for this action.
        $event_component = $this->action_manager->findOrCreateComponent($event);
        $author_component = $this->action_manager->findOrCreateComponent($author);

        // Add timeline entries for each group.
        foreach ($event->getGroups() as $group) {
            foreach ($event->getInvitations() as $invitation) {
                $invitee = $this->user_provider->loadUserByUsername($invitation->getInvitee());
                $invitee_component = $this->action_manager->findOrCreateComponent($invitee);

                // Create the action and link it.
                $action = $this->action_manager->create($author_component, 'invited', [
                    'directComplement' => $invitee_component,
                    'indirectComplement' => $event_component,
                ]);

                // Update the action.
                $this->action_manager->updateAction($action);
            }
        }
    }
641752
@Override
	public void publish(Event event) {

		// Connected
		if (event instanceof ConnectedEvent) {
			if (status.compareAndSet(STATUS_CONNECTING_1, STATUS_CONNECTING_2)) {

				// First connection is Ok
				return;
			}
			if (status.compareAndSet(STATUS_CONNECTING_2, STATUS_CONNECTED)) {

				// Second connection is Ok
				logger.info("All Redis pub-sub connections estabilished.");
				connected(false);
			}
			return;
		}

		// Disconnected
		if (event instanceof DisconnectedEvent) {
			int s = status.getAndSet(STATUS_DISCONNECTED);
			if (s != STATUS_DISCONNECTED && s != STATUS_DISCONNECTING) {
				logger.info("Redis pub-sub connection aborted.");
				reconnect();
			}
		}

	}
241332
public function onMessagePublished(MessagePublishedEvent $event)
    {
        $this->data[] = array(
            'message_type' => $event->getMessageType(),
            'message' => $event->getMessage(),
            'connection' => $event->getConnection(),
            'exchange' => $event->getExchange(),
            'routing_key' => $event->getRoutingKey(),
        );
    }
1123788
private void onParticipantUpdated(ParticipantUpdatedEvent event) {
        handler.post(() -> listener.onParticipantUpdated(event));
        log("Event published " + event.toString());
    }
1166403
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo) {
        if (getBatchEventsPublisher() != null) {
            getBatchEventsPublisher().publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
151030
private void onMessageRead(MessageReadEvent event) {
        handler.post(() -> listener.onMessageRead(event));
        log("Event published " + event.toString());
    }
957704
public function onAfterPublish()
    {
        // store IDs of fields we've published
        $seenIDs = [];
        foreach ($this->owner->Fields() as $field) {
            // store any IDs of fields we publish so we don't unpublish them
            $seenIDs[] = $field->ID;
            $field->doPublish(Versioned::DRAFT, Versioned::LIVE);
            $field->destroy();
        }

        // fetch any orphaned live records
        $live = Versioned::get_by_stage(EditableFormField::class, Versioned::LIVE)
            ->filter([
                'ParentID' => $this->owner->ID,
            ]);

        if (!empty($seenIDs)) {
            $live = $live->exclude([
                'ID' => $seenIDs,
            ]);
        }

        // delete orphaned records
        foreach ($live as $field) {
            $field->deleteFromStage(Versioned::LIVE);
            $field->destroy();
        }
    }
1223350
public function preUpdate(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Active unpublished objects should be published.
        if ($object->isActive() && !$object->isPublished()) {
            $object->setPublished(true);
        }
    }
1195232
@SuppressWarnings("unchecked")
  private void handlePublish(PublishRequest request) {
    state.getLogger().trace("{} - Received {}", state.getSessionId(), request);

    // If the request is for another session ID, this may be a session that was previously opened
    // for this client.
    if (request.session() != state.getSessionId()) {
      state.getLogger().trace("{} - Inconsistent session ID: {}", state.getSessionId(), request.session());
      return;
    }

    // If the request event index has already been processed, return.
    if (request.eventIndex() <= state.getEventIndex()) {
      return;
    }

    // If the request's previous event index doesn't equal the previous received event index,
    // respond with an undefined error and the last index received. This will cause the cluster
    // to resend events starting at eventIndex + 1.
    if (request.previousIndex() != state.getEventIndex()) {
      state.getLogger().trace("{} - Inconsistent event index: {}", state.getSessionId(), request.previousIndex());
      connection.send(ResetRequest.builder()
        .withSession(state.getSessionId())
        .withIndex(state.getEventIndex())
        .build());
      return;
    }

    // Store the event index. This will be used to verify that events are received in sequential order.
    state.setEventIndex(request.eventIndex());

    sequencer.sequenceEvent(request, () -> {
      for (Event<?> event : request.events()) {
        Set<Consumer> listeners = eventListeners.get(event.name());
        if (listeners != null) {
          for (Consumer listener : listeners) {
            listener.accept(event.message());
          }
        }
      }
    });
  }
730731
public function handlePublishPageNumber(PublishEvent $event)
    {
        $document = $event->getDocument();
        $node = $event->getNode();
        $propertyName = $this->propertyEncoder->systemName(static::FIELD);
        if (!$document instanceof PageBehavior) {
            return;
        }

        $node->setProperty($propertyName, $document->getPageNumber());
    }
545128
public function updateEventsAfterPublish()
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        /** @var $entityManager EntityManager */
        $entityManager = $this->entityManager;

        foreach ($this->scheduledNodeEventUpdates as $documentPublish) {
            /* @var $nodeEvent NodeEvent */
            $nodeEvent = $this->eventEmittingService->emit(self::DOCUMENT_PUBLISHED, [], NodeEvent::class);
            $nodeEvent->setNode($documentPublish['documentNode']);
            $nodeEvent->setWorkspaceName($documentPublish['targetWorkspace']);
            $this->persistenceManager->whitelistObject($nodeEvent);
            $this->persistenceManager->persistAll(true);

            $parentEventIdentifier = $this->persistenceManager->getIdentifierByObject($nodeEvent);

            $qb = $entityManager->createQueryBuilder();
            $qb->update(NodeEvent::class, 'e')
                ->set('e.parentEvent', ':parentEventIdentifier')
                ->setParameter('parentEventIdentifier', $parentEventIdentifier)
                ->where('e.parentEvent IS NULL')
                ->andWhere('e.workspaceName = :workspaceName')
                ->setParameter('workspaceName', $documentPublish['workspaceName'])
                ->andWhere('e.documentNodeIdentifier = :documentNodeIdentifier')
                ->setParameter('documentNodeIdentifier', $documentPublish['documentNode']->getIdentifier())
                ->andWhere('e.eventType != :publishedEventType')
                ->setParameter('publishedEventType', self::DOCUMENT_PUBLISHED)
                ->getQuery()->execute();
        }

        $this->scheduledNodeEventUpdates = [];
    }
560581
private void publishEvent(WSJobInstance objectToPublish, String eventToPublish) {

        if (getBatchEventsPublisher() != null) {
            getBatchEventsPublisher().publishJobInstanceEvent(objectToPublish, eventToPublish, correlationId);
        }
    }
1045597
private void publishEvent(WSJobInstance objectToPublish, String eventToPublishTo, String correlationId) {
        if (eventsPublisher != null) {
            eventsPublisher.publishJobInstanceEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
687050
public void addAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
        if (events != null && !events.isEmpty()) {
            for (TimelineEvent event : events) {
                add(event, timelineUpdater);
            }
        }
    }
1206250
private void onParticipantRemoved(ParticipantRemovedEvent event) {
        handler.post(() -> listener.onParticipantRemoved(event));
        log("Event published " + event.toString());
    }
359533
async def emit_event(self, event):
        
        self.log.info("publishing event on %s", self.publish_topic)
        if self.config.extra['config']['pub_options']['retain']:
            try:
                await persist_event(
                    self.publish_topic,
                    event,
                    self.pool
                )
            except SystemError as error:
                self.log.error(error)
                return

        await asyncio.sleep(1)
521818
public function setBlamesOnNodeForPublish(PublishEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        $this->setBlamesOnNode(
            $document,
            $event->getNode(),
            $event->getLocale(),
            $event->getAccessor(),
            $document->getChanger()
        );
    }