/**
  * @param OutgoingSendContext $context
  * @param callable            $next
  */
 public function invoke($context, callable $next)
 {
     $addressTags = $this->unicastRouter->route($context->getSendOptions(), $context->getMessageClass());
     if (empty($addressTags)) {
         throw new RoutingException("The message destination could not be determined. You may have misconfigured the destination for this kind of message ({$context->getMessageClass()}) when you registered the message to endpoint mappings.");
     }
     $context->setHeader(HeaderTypeEnum::MESSAGE_INTENT, MessageIntentEnum::SEND);
     $logicalMessageContext = $this->contextFactory->createLogicalMessageContextFromSendContext($addressTags, $context);
     $next($logicalMessageContext);
 }
Exemplo n.º 2
0
 /**
  * @param AddressTagInterface[] $addressTags
  * @param OutgoingSendContext   $parentContext
  *
  * @return OutgoingLogicalMessageContext
  */
 public function createLogicalMessageContextFromSendContext(array $addressTags, OutgoingSendContext $parentContext)
 {
     return new OutgoingLogicalMessageContext($parentContext->getMessageId(), $parentContext->getHeaders(), $parentContext->getLogicalMessage(), $addressTags, $parentContext->getSendOptions()->isImmediateDispatchEnabled(), $parentContext->getIncomingPhysicalMessage(), $parentContext->getPendingTransportOperations(), $parentContext);
 }