/** * @param OutgoingLogicalMessageContext $context * @param callable $next */ public function invoke($context, callable $next) { $context->setHeader(HeaderTypeEnum::CONTENT_TYPE, $this->messageSerializer->getContentType()); $context->setHeader(HeaderTypeEnum::ENCLOSED_CLASS, $context->getMessage()->getMessageClass()); $body = $this->messageSerializer->serialize($context->getMessage()->getMessageInstance()); $outgoingPhysicalContext = $this->contextFactory->createPhysicalMessageContext($body, $context); $next($outgoingPhysicalContext); }
/** * @param OutgoingLogicalMessageContext $context * @param callable $next */ public function invoke($context, callable $next) { $correlationId = null; if ($context->getIncomingPhysicalMessage()) { $incomingHeaders = $context->getIncomingPhysicalMessage()->getHeaders(); if (isset($incomingHeaders[HeaderTypeEnum::CORRELATION_ID])) { $correlationId = $incomingHeaders[HeaderTypeEnum::CORRELATION_ID]; } if (!$correlationId && isset($incomingHeaders[HeaderTypeEnum::MESSAGE_ID])) { $correlationId = $incomingHeaders[HeaderTypeEnum::MESSAGE_ID]; } } if (!$correlationId) { $correlationId = $context->getMessageId(); } $context->setHeader(HeaderTypeEnum::CORRELATION_ID, $correlationId); $next(); }
/** * @param OutgoingLogicalMessageContext $context * @param callable $next */ public function invoke($context, callable $next) { $context->setHeader(HeaderTypeEnum::REPLY_TO_ADDRESS, $this->replyToAddress); $next(); }