public function invoke(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse)
    {

        // load the application context
        /** @var \AppserverIo\Appserver\Application\Application $application */
        $application = $servletRequest->getContext();

        // unpack the message
        $message = MessageQueueProtocol::unpack($servletRequest->getBodyContent());

        // load message queue name
        $queueName = $message->getDestination()->getName();

        // lookup the message queue manager and attach the message
        $queueManager = $application->search(QueueContextInterface::IDENTIFIER);
        if ($messageQueue = $queueManager->lookup($queueName)) {
            $messageQueue->attach($message);
        } else {
            throw new \Exception("Can\'t find queue for message queue $queueName");
        }

        // finally dispatch this request, because we have finished processing it
        $servletRequest->setDispatched(true);
    }
public function invoke(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse)
    {

        // load the application context
        /** @var \AppserverIo\Appserver\Application\Application $application */
        $application = $servletRequest->getContext();

        // unpack the message
        $message = MessageQueueProtocol::unpack($servletRequest->getBodyContent());

        // load message queue name
        $queueName = $message->getDestination()->getName();

        // lookup the message queue manager and attach the message
        $queueManager = $application->search(QueueContextInterface::IDENTIFIER);
        if ($messageQueue = $queueManager->lookup($queueName)) {
            $messageQueue->attach($message);
        } else {
            throw new \Exception("Can\'t find queue for message queue $queueName");
        }

        // finally dispatch this request, because we have finished processing it
        $servletRequest->setDispatched(true);
    }
public function invoke ( HttpServletRequestInterface $ servletRequest , HttpServletResponseInterface $ servletResponse ) { // load the application context /** @var \AppserverIo\Appserver\Application\Application $application */ $ application = $ servletRequest -> getContext ( ) ; // unpack the message $ message = MessageQueueProtocol :: unpack ( $ servletRequest -> getBodyContent ( ) ) ; // load message queue name $ queueName = $ message -> getDestination ( ) -> getName ( ) ; // lookup the message queue manager and attach the message $ queueManager = $ application -> search ( QueueContextInterface :: IDENTIFIER ) ; if ( $ messageQueue = $ queueManager -> lookup ( $ queueName ) ) { $ messageQueue -> attach ( $ message ) ; } else { throw new \ Exception ( "Can\'t find queue for message queue $queueName" ) ; } // finally dispatch this request, because we have finished processing it $ servletRequest -> setDispatched ( true ) ; }
Processes the request by invoking the request handler that attaches the message to the
requested queue in a protected context.

@param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface  $servletRequest  The request instance
@param \AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse The response instance

@return void
@throws \Exception Is thrown if the requested message queue is not available
Processes the request by invoking the request handler that attaches the message to the requested queue in a protected context .