@param PublishNode $command
@param Pbjx        $pbjx

@return NodePublished
172851
protected function createNodePublished(PublishNode $command, Pbjx $pbjx): NodePublished
    {
        /** @var NodePublished $event */
        $event = $this->createEventFromCommand($command, 'published');
        return $event;
    }
649317
@Override
	public TopicPublisher createPublisher(Topic topic) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        LocalTopicPublisher publisher = new LocalTopicPublisher(this,topic,idProvider.createID());
	        registerProducer(publisher);
	        return publisher;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
1189611
def update_nodes_published(self):
        
        if self.pk:
            self.node_set.all().update(is_published=self.is_published)
1182788
public function publishNodeAction(NodeInterface $node, Workspace $selectedWorkspace)
    {
        $this->publishingService->publishNode($node);
        $this->addFlashMessage($this->translator->translateById('workspaces.selectedChangeHasBeenPublished', [], null, null, 'Modules', 'Neos.Neos'));
        $this->redirect('show', null, null, ['workspace' => $selectedWorkspace]);
    }
649858
public function handlePublish(PublishEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutableBehavior) {
            return;
        }

        $node = $this->documentInspector->getNode($document);

        try {
            $route = $this->createOrUpdateRoute($document, $event->getLocale());
        } catch (RouteIsNotUniqueException $exception) {
            throw new ResourceLocatorAlreadyExistsException($exception->getRoute()->getPath(), $document->getPath());
        }

        $document->setRoutePath($route->getPath());
        $this->entityManager->persist($route);

        $node->setProperty(
            $this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale()),
            $route->getPath()
        );

        $propertyName = $this->getPropertyName($event->getLocale(), self::ROUTES_PROPERTY);

        // check if nodes previous generated routes exists and remove them if not
        $oldRoutes = $event->getNode()->getPropertyValueWithDefault($propertyName, []);
        $this->removeOldChildRoutes($event->getNode()->getSession(), $oldRoutes, $event->getLocale());

        $routes = [];
        if ($document instanceof ChildrenBehavior) {
            // generate new routes of children
            $routes = $this->generateChildRoutes($document, $event->getLocale());
        }

        // save the newly generated routes of children
        $event->getNode()->setProperty($propertyName, $routes);
        $this->entityManager->flush();
    }
822731
public function basic_publish(
        $msg,
        $exchange = '',
        $routing_key = '',
        $mandatory = false,
        $immediate = false,
        $ticket = null
    ) {
        $pkt = new AMQPWriter();
        $pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));

        try {
            $this->connection->send_content(
                $this->channel_id,
                60,
                0,
                mb_strlen($msg->body, 'ASCII'),
                $msg->serialize_properties(),
                $msg->body,
                $pkt
            );
        } catch (AMQPConnectionClosedException $e) {
            $this->do_close();
            throw $e;
        }

        if ($this->next_delivery_tag > 0) {
            $this->published_messages[$this->next_delivery_tag] = $msg;
            $this->next_delivery_tag = bcadd($this->next_delivery_tag, '1', 0);
        }
    }
256991
public function onPublisherAction(RSQueuePublisherEvent $event)
    {
        $this->data['total']++;
        $this->data['publ'][] = array(
            'payload'   =>  $event->getPayloadSerialized(),
            'queue'     =>  $event->getChannelName(),
            'alias'     =>  $event->getChannelAlias(),
        );

        return $this;
    }
874028
protected function publishNodeCanBeSkipped(NodeInterface $node, Workspace $targetWorkspace)
    {
        if ($this->baseWorkspace === null) {
            return true;
        }
        if ($node->getWorkspace() !== $this) {
            return true;
        }
        // Might happen if a node which has been published during an earlier call of publishNode() is attempted to
        // be published again:
        if ($node->getWorkspace() === $targetWorkspace) {
            return true;
        }
        $this->verifyPublishingTargetWorkspace($targetWorkspace);
        if ($node->getPath() === '/') {
            return true;
        }

        return false;
    }
422287
protected function publish(InputInterface $input, OutputInterface $output, $profile_name) {
        $output->writeln('<info>Publishing to '.$profile_name.'...</info>');
        $parser = new Parser();
        $profile_config = $parser->parse(file_get_contents('deployement/publish_'.$profile_name.'.yml'));

        if(!CommandUtils::checkCommand('rsync')) {
            $output->writeln('<error>rsync not installed, please install it. Exiting now...</error>');
            return 1;
        }
        if($profile_config['use_pem']) {
            $command = 'rsync -rltDvze "ssh -i '.$profile_config['pem_path'].'" ';
        }
        else {
            $command = 'rsync -rltDvz ';
        }

        $is_full = $input->getOption('full');
        if(!$is_full) {
            foreach ($profile_config['exclude'] as $exclude) {
                $command .= '--exclude \'' . $exclude . '\' ';
            }
        }

        if(substr($profile_config['remote_dir'],-1,1) != '/') {
            $profile_config['remote_dir'] .= '/';
        }

        $command .= '. '.$profile_config['username'].'@'.$profile_config['host'].':'.$profile_config['remote_dir'];


        $chmod = array(
            'chown -R '.$profile_config['username'].':'.$profile_config['remote_group'].' '.$profile_config['remote_dir'],
            'chmod -R 750 '.$profile_config['remote_dir'],
            'chmod -R 770 '.$profile_config['remote_dir'].'app/logs',
            'chmod -R 770 '.$profile_config['remote_dir'].'app/proxies',
            'chmod -R 770 '.$profile_config['remote_dir'].'app/public',
            'chmod -R 770 '.$profile_config['remote_dir'].'app/tmp'
        );

        $permissions_commands = 'ssh '
            .($profile_config['use_pem']?'-i '.$profile_config['pem_path']:'')
            .' '
            .$profile_config['username']
            .'@'
            .$profile_config['host']
            .' '
            .($profile_config['use_sudo']?'sudo':'')
            .' \'';
        foreach($chmod as $c) {
                $permissions_commands .= $c. ' && ';
        }
        $permissions_commands = substr($permissions_commands, 0, -3);
        $permissions_commands .= '\'';

        // PUBLISH
        $dump_commands = $input->getOption('dump-commands');
        if($dump_commands) {
            $output->writeln($command);
        }
        else {
            $output->writeln('Publishing with rsync, please wait (it may take a while)...');
            passthru($command);
            $output->writeln('<info>PUBLISH DONE</info>');
        }

        // OPTIMIZE
        $run_optimize = $profile_config['always_run_optimize'];
        if($run_optimize) {
            $output->writeln('Run optimizations...');
            $command = 'ssh '
                .($profile_config['use_pem']?'-i '.$profile_config['pem_path']:'')
                .' '
                .$profile_config['username']
                .'@'
                .$profile_config['host']
                .' '
                .'\'cd '.$profile_config['remote_dir'].' && vendor/bin/pff deploy:optimize\'';

            if($dump_commands) {
                $output->writeln($command);
            }
            else {
                passthru($command);
            }
            $output->writeln('<info>OPTIMIZE DONE</info>');
        }

        // PERMISSIONS
        $output->writeln('Setting permissions...');
        if($dump_commands) {
            $output->writeln($permissions_commands);
        }
        else {
            passthru($permissions_commands);
        }
        $output->writeln('<info>PERMISSIONS DONE</info>');

    }
1110742
protected function handle(EchoRequest $request, Pbjx $pbjx): EchoResponse
    {
        return EchoResponseV1::create()->set('msg', $request->get('msg'));
    }
1246411
public function validateCreateNode(PbjxEvent $pbjxEvent): void
    {
        $command = $pbjxEvent->getMessage();
        if (!$command->has('node')) {
            return;
        }

        /** @var Node $node */
        $node = $command->get('node');
        if ($this->shouldIgnoreNode($node)) {
            return;
        }

        /** @var CacheItemInterface[] $cacheItems */
        $cacheItems = $this->cache->getItems($this->getIdempotencyKeys($node));

        foreach ($cacheItems as $cacheItem) {
            if (!$cacheItem->isHit()) {
                continue;
            }

            throw new NodeAlreadyExists(
                sprintf(
                    'A similar [%s] was just created moments ago so [%s] cannot continue.',
                    $node::schema()->getCurie()->getMessage(),
                    $command->generateMessageRef()
                )
            );
        }
    }
596008
protected function createAppRolesGranted(GrantRolesToApp $command, Pbjx $pbjx): AppRolesGranted
    {
        /** @var AppRolesGranted $event */
        $event = AppRolesGrantedV1Mixin::findOne()->createMessage();
        return $event;
    }
12037
protected function createNodeMarkedAsPending(MarkNodeAsPending $command, Pbjx $pbjx): NodeMarkedAsPending
    {
        /** @var NodeMarkedAsPending $event */
        $event = $this->createEventFromCommand($command, 'marked-as-pending');
        return $event;
    }
95375
protected function createResponseFromRequest(Request $request, Pbjx $pbjx): Response
    {
        $curie = str_replace('-request', '-response', $request::schema()->getCurie()->toString());
        /** @var Response $class */
        $class = MessageResolver::resolveCurie(SchemaCurie::fromString($curie));
        return $class::create();
    }
277081
public function getNodeById($id, $published)
    {
        return $published ? PublishedNode::find($id) : Node::find($id);
    }
943709
protected function bindFromNode(Message $message, Node $node, Pbjx $pbjx): void
    {
        $node->freeze();
        $pbjxEvent = new BindFromNodeEvent($message, $node);
        $pbjx->trigger($message, 'bind_from_node', $pbjxEvent, false);
    }
1373084
function onPublish( $object, $nodes  )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            $dataType->onPublish( $this, $object, $nodes );
    }