Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * It allows you to configure which endpoints should receive a command message.
  * Command messages are those being sent via ->send and not via ->publish.
  *
  * @param string $messageFqcn
  * @param string $endpointName
  */
 public function registerCommandRoutingRule($messageFqcn, $endpointName)
 {
     $this->unicastRoutingTable->routeToEndpoint($messageFqcn, $endpointName);
 }