Push data to task

@param array $message
@param callable $messageHandler
@return null
973102
public function push(array $message, callable $messageHandler) {

        $this->beanstalkMapper->put(serialize(
            array_merge(
                $messageHandler(), $message
            )
        ));

        return null;
    }
1291141
public void pushMessage(IMessage message) throws IOException {
        if (log.isDebugEnabled()) {
            log.debug("pushMessage: {} to {} consumers", message, consumers.size());
        }
        for (IConsumer consumer : consumers) {
            try {
                ((IPushableConsumer) consumer).pushMessage(this, message);
            } catch (Throwable t) {
                if (t instanceof IOException) {
                    throw (IOException) t;
                }
                log.error("Exception pushing message to consumer", t);
            }

        }
    }
1069376
public function logMessage(Message $message) {
        foreach($this->logger as $logger) {
            $logger->logMessage($message);
        }
    }
774690
public function editMessageAction(Message $message)
    {
        $subject = $message->getSubject();
        $forum = $subject->getCategory()->getForum();
        $isModerator = $this->authorization->isGranted('moderate', new ResourceCollection(array($forum->getResourceNode())));

        if (!$isModerator && $this->tokenStorage->getToken()->getUser() !== $message->getCreator()) {
            throw new AccessDeniedException();
        }

        $oldContent = $message->getContent();
        $form = $this->container->get('form.factory')->create(new MessageType, new Message());
        $form->handleRequest($this->get('request'));

        if ($form->isValid()) {
            $newContent = $form->get('content')->getData();
            $this->manager->editMessage($message, $oldContent, $newContent);

            return new RedirectResponse(
                $this->generateUrl('claro_forum_messages', array('subject' => $subject->getId()))
            );
        }

        return array(
            'subject' => $subject,
            'form' => $form->createView(),
            'message' => $message,
            '_resource' => $forum,
            'workspace' => $forum->getResourceNode()->getWorkspace()
        );
    }
1344096
public function put($message)
    {
        if (!\msg_send($this->queue, $this->msg_type, $message, $this->serialize_needed, $this->block_send, $err) === true) {
            throw new \RuntimeException($err);
        }

        return true;
    }
149170
public function push(QueueMessage $message)
    {
        $request = [
            'QueueUrl' => $this->getQueueUrl($message->getQueueName()),
            'MessageBody' => json_encode($message),
        ];

        $request['DelaySeconds'] = $message->getDelay();

        $options = $message->getOptions();

        $request = array_merge($request, $options);

        return $this->client->sendMessage($request)->get('MessageId');
    }
460679
private function handleMessage(HandlerInterface $handler, MessageInterface $message): bool
    {
        // check if handler implements Psr\Log\LoggerAwareInterface (you can use \Psr\Log\LoggerAwareTrait)
        if ($this->logger && method_exists($handler, 'setLogger')) {
            $handler->setLogger($this->logger);
        }

        try {
            $result = $handler->handle($message);

            $this->log(
                LogLevel::INFO,
                "End handle message #{$message->getId()} ({$message->getType()})",
                $this->messageLoggerContext($message)
            );
        } catch (Exception $e) {
            $this->log(
                LogLevel::ERROR,
                "Handler " . get_class($handler) . " throws exception - {$e->getMessage()}",
                ['error' => $e, 'message' => $this->messageLoggerContext($message), 'exception' => $e]
            );
            Debugger::log($e, Debugger::EXCEPTION);
            $result = false;
        }
        return $result;
    }
334917
public function handles(Message $message): bool
    {
        try {
            $this->getNotifierForMessage($message);

            return true;
        } catch (NotifierNotFoundException $e) {
            return false;
        }
    }
60915
public function save(Message $message) : ?Message
    {
        $aggregate = $message->getHeaders()->get(AggregateMessage::AGGREGATE_OBJECT);

        $this->aggregateRepository->save($message->getHeaders()->get(AggregateMessage::CALLING_MESSAGE), $aggregate);

        if ($message->getHeaders()->get(AggregateMessage::IS_FACTORY_METHOD)) {
            $aggregate = $message->getHeaders()->get(AggregateMessage::AGGREGATE_OBJECT);
            $aggregateIds = [];

            foreach ($message->getHeaders()->get(AggregateMessage::AGGREGATE_ID) as $aggregateIdName => $aggregateIdValue) {
                $aggregateIds[$aggregateIdName] = $this->propertyReaderAccessor->getPropertyValue(PropertyPath::createWith($aggregateIdName), $aggregate);
            }

            $payload = count($aggregateIds) === 1 ? array_shift($aggregateIds) : $aggregateIds;

            return
                MessageBuilder::fromMessage($message)
                    ->setPayload($payload)
                    ->build();
        }

        return $message;
    }
379359
private function isForeachProcessPossible(Message $message, MessageHandler $messageHandler)
    {
        if ($message->processingType()->typeDescription()->nativeType() !== NativeType::COLLECTION) {
            return false;
        }

        $itemMessage = Message::emulateProcessingWorkflowMessage(
            $message->messageType(),
            $message->processingType()->typeProperties()['item']->typePrototype(),
            $message->processingMetadata()
        );

        return $messageHandler->canHandleMessage($itemMessage);
    }
652584
public function publish($channel, $message)
    {
        $topic = $this->getTopicForChannel($channel);
        $payload = Utils::serializeMessage($message);

        if ($this->backgroundBatching) {
            $topic->batchPublisher()->publish(['data' => $payload]);
        } else {
            $topic->publish(['data' => $payload]);
        }
    }
1246816
protected function dispatch($message, MessageCallback $callback) : void
    {
        $handled = false;
        foreach ($this->callableWrappersFor($message) as $callable) {
            $handled = true;
            if ($message instanceof PropagationStoppable && $message->isPropagationStopped()) {
                break;
            }
            try {
                $result = $callable->invoke($message);
                self::getLogger()->debug(
                    "The following message has been dispatched to handler '{}' through message bus '{}': {}",
                    [$callable, $this, $message]
                );
                if ($result !== null) {
                    $callback->onSuccess($result);
                }
            } catch (Exception $exp) {
                self::getLogger()->warn(
                    "An error occurred in the following message handler through message bus '{}': {}, message is {}!",
                    [$this, $callable, $message],
                    $exp
                );
                $context = new SubscriberExceptionContext($this, $message, $callable);
                try {
                    $this->exceptionHandler->handleException($exp, $context);
                } catch (Exception $e) {
                    self::getLogger()->error(
                        "An error occurred in the exception handler with context '{}'",
                        [$context],
                        $e
                    );
                }
                try {
                    $callback->onFailure($exp);
                } catch (Exception $e) {
                    self::getLogger()->error("An error occurred in message callback on bus '{}'", [$this], $e);
                }
            }
        }
        if (!$handled && !($message instanceof DeadMessage)) {
            self::getLogger()->debug(
                "The following message as a DeadMessage is being posted to '{}' message bus: {}",
                [$this, $message]
            );
            $this->dispatch(new DeadMessage($message), $callback);
        }
    }
1143598
public function push($queueName, Message $message)
    {
        $cache = $this->get($queueName);
        $cache->enqueue($message);
    }
875459
public function onJobMessage(array $message) : bool
    {
        $jobName = $message[0];
        $jobId = $message[1];
        $workerId = $message[2];
        $payload = $message[3];

        // Skip if job is assigned to another worker:
        if ($workerId !== $this->workerId) {
            return false;
        }

        // Skip if worker can not handle the requested job
        if (!isset($this->callbacks[$jobName])) {
            throw new WorkerException('No callback found for requested job.');
        }

        // Switch to busy state handle job and switch back to idle state:
        $this->jobId = $jobId;
        $this->setState(Worker::WORKER_STATE_BUSY);
        $result = call_user_func($this->callbacks[$jobName], $payload);
        $this->onJobCompleted($result);
        $this->setState(Worker::WORKER_STATE_IDLE);
        return true;
    }
895505
public function add(Message $message)
    {
        $this->queue->insert($message, is_null($message->getPosition()) ? null : -$message->getPosition());

        $this->copyQueue(clone $this->queue);

        return $this;
    }
1326699
public function pushLog($message, array $context = [])
    {
        if ($this->logFile) {
            Log::getInstance([
                'channel' => 'SQL',
                'level' => 'info',
                'maxSize' => 1000000, // default
            ])->pushInfo($message, $context);
        }
    }
544118
public function send(Message $message)
    {
        $em = $this->getEventManager();
        $event = $this->getEvent();
        $event->setMessage($message);
        $event->setName(SenderEvent::EVENT_SEND_PRE);
        $em->triggerEvent($event);
        $this->transport->send($message);
        $event->setName(SenderEvent::EVENT_SEND_POST);
        $em->triggerEvent($event);
    }