Class BlockingResponseCallback

  • All Implemented Interfaces:
    ResponseCallback

    public class BlockingResponseCallback
    extends Object
    implements ResponseCallback
    Simple blocking response callback backed by blocking queue that will allow sequential access to responses and block
    • client if there is no message yet
    • server if the queue is full
    .
    • Constructor Detail

      • BlockingResponseCallback

        public BlockingResponseCallback​(org.kie.server.api.marshalling.Marshaller marshaller)
      • BlockingResponseCallback

        public BlockingResponseCallback​(org.kie.server.api.marshalling.Marshaller marshaller,
                                        int queueSize)
    • Method Detail

      • onResponse

        public void onResponse​(String selector,
                               org.kie.server.api.model.ServiceResponsesList response)
        Description copied from interface: ResponseCallback
        Invoked by async message listener when response was received that matches given selector
        Specified by:
        onResponse in interface ResponseCallback
        Parameters:
        selector - message selector used to filter messages
        response - actual (unmarshalled) response received from the server.
      • get

        public org.kie.server.api.model.ServiceResponsesList get()
        Description copied from interface: ResponseCallback
        Returns received value if any. It's up to implementation to either block while waiting for the response or return directly with null in case there is no response available
        Specified by:
        get in interface ResponseCallback
        Returns:
        returns message received from the server, if exists
      • get

        public <T> T get​(Class<T> type)
        Description copied from interface: ResponseCallback
        Returns deserialized version of the response - it's taken from ServiceResponseList.getResponses().get(0).getResult(). It attempts to provide as much as possible smooth usage as it would be directly via *ServiceClient
        Specified by:
        get in interface ResponseCallback
        Type Parameters:
        T - actual type expected
        Parameters:
        type - class type of expected result
        Returns: