Package org.kie.server.client.jms
Class AsyncResponseHandler
- java.lang.Object
-
- org.kie.server.client.jms.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 Summary
Constructors Constructor Description AsyncResponseHandler(ResponseCallback callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose(javax.jms.Connection connection, javax.jms.Session session)
Responsible for close of resources.int
getInteractionPattern()
Returns int identifying supported interaction pattern for JMSorg.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)
Deals with response if needed according to given interaction pattern it supports.
-
-
-
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 interfaceResponseHandler
- 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 interfaceResponseHandler
- Parameters:
selector
- message selector to pick only response for given messageconnection
- JMS connection to be usedsession
- JMS session to be usedresponseQueue
- queue that should have response delivered toconfig
- kie server client configurationmarshaller
- marshaller to be used after message is receivedowner
- 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 interfaceResponseHandler
- Parameters:
connection
- jms connection usedsession
- jms session used
-
-