Class AsyncResponseHandler

  • All Implemented Interfaces:
    ResponseHandler

    public class AsyncResponseHandler
    extends Object
    implements ResponseHandler
    Async response handler that receives message from response queue using message listener. It requires callback to be invoked upon message delivery otherwise will throw IllegalStateException on runtime.
    Due to nature of message listener (cannot clean up its connection and session) another thread is used to perform the cleanup in finally block of message listener.
    Response is only delivered via callback thus return value of handleResponse is always single ServiceResponse of type NO_RESPONSE
    • Constructor Detail

      • AsyncResponseHandler

        public AsyncResponseHandler​(ResponseCallback callback)
    • Method Detail

      • getInteractionPattern

        public int getInteractionPattern()
        Description copied from interface: ResponseHandler
        Returns int identifying supported interaction pattern for JMS
        Specified by:
        getInteractionPattern in interface ResponseHandler
        Returns:
        See Also:
        for interaction pattern constants
      • handleResponse

        public org.kie.server.api.model.ServiceResponsesList handleResponse​(String selector,
                                                                            javax.jms.Connection connection,
                                                                            javax.jms.Session session,
                                                                            javax.jms.Queue responseQueue,
                                                                            KieServicesConfiguration config,
                                                                            org.kie.server.api.marshalling.Marshaller marshaller,
                                                                            KieServicesClient owner)
        Description copied from interface: ResponseHandler
        Deals with response if needed according to given interaction pattern it supports.
        Specified by:
        handleResponse in interface ResponseHandler
        Parameters:
        selector - message selector to pick only response for given message
        connection - JMS connection to be used
        session - JMS session to be used
        responseQueue - queue that should have response delivered to
        config - kie server client configuration
        marshaller - marshaller to be used after message is received
        owner - top level kie server client that owns the service client
        Returns:
        ServiceResponseList produced from response message
      • dispose

        public void dispose​(javax.jms.Connection connection,
                            javax.jms.Session session)
        Description copied from interface: ResponseHandler
        Responsible for close of resources. Up to implementation if they can be closed directly or after async processing, etc
        Specified by:
        dispose in interface ResponseHandler
        Parameters:
        connection - jms connection used
        session - jms session used