Beispiel #1
0
 /**
  * @param PendingTransportOperations     $pendingTransportOperations
  * @param IncomingPhysicalMessageContext $physicalMessageContext
  */
 private function dispatchPendingOperations(PendingTransportOperations $pendingTransportOperations, IncomingPhysicalMessageContext $physicalMessageContext)
 {
     if ($pendingTransportOperations->hasOperations()) {
         $dispatchContext = $this->outgoingContextFactory->createDispatchContext($pendingTransportOperations->getOperations(), $physicalMessageContext);
         $this->dispatchPipeline->invoke($dispatchContext);
     }
 }
 /**
  * @param TransportReceiveContext $context
  * @param callable                $next
  */
 public function invoke($context, callable $next)
 {
     try {
         $next();
     } catch (CriticalErrorException $e) {
         // all hope is gone
         throw $e;
     } catch (\Exception $e) {
         $incomingMessage = $context->getMessage();
         $incomingMessage->revertToOriginalBodyIfNeeded();
         $exceptionHeaders = $this->exceptionConverter->convert($e, $this->localAddress);
         $newHeaders = array_merge($incomingMessage->getHeaders(), $exceptionHeaders);
         $outgoingMessage = new OutgoingPhysicalMessage($incomingMessage->getMessageId(), $newHeaders, $incomingMessage->getBody());
         $dispatchContext = $this->contextFactory->createDispatchContext([new TransportOperation($outgoingMessage, new UnicastAddressTag($this->errorQueueAddress))], $context);
         $this->dispatchPipeline->invoke($dispatchContext);
     }
 }