/**
  * @inheritdoc
  */
 public function __invoke(Message $message, Deferred $deferred = null)
 {
     if (null !== $deferred) {
         throw new RuntimeException(__CLASS__ . ' cannot handle query messages which require future responses.');
     }
     $this->bernardProducer->produce($this->toBernardMessage($message), $this->queue);
 }
 public function testProduce()
 {
     $type = 'JobType';
     $ticket = 'JobTicket';
     $queue = 'QueueName';
     $message = new Message($type, $ticket);
     $jobType = $this->createMock(JobTypeInterface::class);
     $jobType->expects($this->once())->method('getQueue')->willReturn($queue);
     $producerMessage = new DefaultMessage('ConsumeJob', ['type' => $type, 'ticket' => $ticket]);
     $this->registry->expects($this->once())->method('get')->with($message->getType())->willReturn($jobType);
     $this->producer->expects($this->once())->method('produce')->with($producerMessage, $queue);
     $this->subject->produce($message);
 }
 /**
  * @param Message     $message
  * @param string|null $queueName
  */
 public function produce(Message $message, $queueName = null)
 {
     if ($message instanceof AbstractExplicitMessage) {
         return parent::produce($message, $queueName ?: $message->getQueue());
     }
     return parent::produce($message, $queueName);
 }
Example #4
0
    echo '<cdash version="' . $CDASH_VERSION . "\">\n";
    echo " <status>ERROR</status>\n";
    echo " <message>Not a valid project.</message>\n";
    echo "</cdash>\n";
    add_log('Not a valid project. projectname: ' . $projectname, 'global:submit.php');
    return;
}
// Catch the fatal errors during submission
register_shutdown_function('PHPErrorHandler', $projectid);
$expected_md5 = isset($_GET['MD5']) ? htmlspecialchars(pdo_real_escape_string($_GET['MD5'])) : '';
$file_path = 'php://input';
$fp = fopen($file_path, 'r');
if ($CDASH_BERNARD_SUBMISSION) {
    // @todo what serializer should be used?
    $factory = new PersistentFactory($CDASH_BERNARD_DRIVER, new Serializer());
    $producer = new Producer($factory, new EventDispatcher());
    $buildSubmissionId = Uuid::uuid4()->toString();
    $destinationFilename = $CDASH_BACKUP_DIRECTORY . '/' . $buildSubmissionId . '.xml';
    if (copy('php://input', $destinationFilename)) {
        $producer->produce(new DefaultMessage('DoSubmit', array('buildsubmissionid' => $buildSubmissionId, 'filename' => $destinationFilename, 'projectid' => $projectid, 'expected_md5' => $expected_md5, 'do_checksum' => true, 'submission_id' => 0, 'submission_ip' => $_SERVER['REMOTE_ADDR'])));
        echo '<cdash version="' . $CDASH_VERSION . "\">\n";
        echo " <status>OK</status>\n";
        echo " <message>Build submitted successfully.</message>\n";
        echo " <submissionId>{$buildSubmissionId}</submissionId>\n";
        echo "</cdash>\n";
    } else {
        add_log('Failed to copy build submission XML', 'global:submit.php', LOG_ERR);
        header('HTTP/1.1 500 Internal Server Error');
        echo '<cdash version="' . $CDASH_VERSION . "\">\n";
        echo " <status>ERROR</status>\n";
        echo " <message>Failed to copy build submission XML.</message>\n";
 /**
  * {@inheritdoc}
  */
 public function produce(Message $message)
 {
     $producerMessage = new DefaultMessage('ConsumeJob', ['type' => $message->getType(), 'ticket' => $message->getTicket()]);
     $this->logger->debug('Publish message to bernard queue backend', ['message' => $message]);
     $this->producer->produce($producerMessage, $this->registry->get($message->getType())->getQueue());
 }