Package org.kie.server.client.jms
Class BlockingResponseCallback
- java.lang.Object
-
- org.kie.server.client.jms.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 Summary
Constructors Constructor Description BlockingResponseCallback(org.kie.server.api.marshalling.Marshaller marshaller)BlockingResponseCallback(org.kie.server.api.marshalling.Marshaller marshaller, int queueSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.kie.server.api.model.ServiceResponsesListget()Returns received value if any.<T> Tget(Class<T> type)Returns deserialized version of the response - it's taken from ServiceResponseList.getResponses().get(0).getResult().voidonResponse(String selector, org.kie.server.api.model.ServiceResponsesList response)Invoked by async message listener when response was received that matches given selector
-
-
-
Method Detail
-
onResponse
public void onResponse(String selector, org.kie.server.api.model.ServiceResponsesList response)
Description copied from interface:ResponseCallbackInvoked by async message listener when response was received that matches given selector- Specified by:
onResponsein interfaceResponseCallback- Parameters:
selector- message selector used to filter messagesresponse- actual (unmarshalled) response received from the server.
-
get
public org.kie.server.api.model.ServiceResponsesList get()
Description copied from interface:ResponseCallbackReturns 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:
getin interfaceResponseCallback- Returns:
- returns message received from the server, if exists
-
get
public <T> T get(Class<T> type)
Description copied from interface:ResponseCallbackReturns 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:
getin interfaceResponseCallback- Type Parameters:
T- actual type expected- Parameters:
type- class type of expected result- Returns:
-
-