/** * @param OutgoingLogicalMessage $message * @param SendOptions $options * @param IncomingPhysicalMessage|null $incomingPhysicalMessage * @param PendingTransportOperations $transportOperations * @param PipelineStageContext $parentContext */ public function __construct(OutgoingLogicalMessage $message, SendOptions $options, IncomingPhysicalMessage $incomingPhysicalMessage = null, PendingTransportOperations $transportOperations = null, PipelineStageContext $parentContext) { parent::__construct($options->getMessageId(), $options->getOutgoingHeaders(), $parentContext); $this->logicalMessage = $message; $this->sendOptions = $options; $this->incomingPhysicalMessage = $incomingPhysicalMessage; $this->pendingTransportOperations = $transportOperations; }
/** * @param SendOptions $options * @param string $messageClass * * @return AddressTagInterface[] */ public function route(SendOptions $options, $messageClass) { $destination = $options->isRoutedToLocalInstance() ? $this->localAddress : null; $destination = $options->getExplicitDestination() ?: $destination; if ($destination === null || $destination === '') { $messageTypes = array_merge([$messageClass], array_values(class_implements($messageClass, true))); $endpointNames = $this->unicastRoutingTable->getEndpointNamesFor($messageTypes); $destinations = []; foreach ($endpointNames as $endpointName) { $destinations[] = $this->transportInfrastructure->toTransportAddress($endpointName); } } else { $destinations = [$destination]; } $addressTags = []; foreach ($destinations as $destination) { $addressTags[] = new UnicastAddressTag($destination); } return $addressTags; }
/** * @param object $message * @param SendOptions $options * @param PipelineStageContext $parentContext */ public function sendLocal($message, SendOptions $options, PipelineStageContext $parentContext) { $options->routeToLocalEndpointInstance(); $this->send($message, $options, $parentContext); }