Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.protocol
Interface RequestChannel

All Superinterfaces:
AsyncChannel, Channel, ChannelListenerSupport
All Known Subinterfaces:
ClusterProtocol, Protocol
All Known Implementing Classes:
AbstractClusterChannel, BasicChatProtocol, CallbackProtocol, ClientChannel, ClusterProtocolImpl, ConfServerProtocol, EmailProtocol, EspClusterProtocol, EspEmailClusterProtocol, EspEmailProtocol, ExternalServiceProtocol, FlexChatClusterProtocol, FlexChatProtocol, InteractionServerProtocol, LcaUdpHeartbeatInternalProtocol, LocalControlAgentProtocol, MessageServerProtocol, OptionalRegistrationChannel, OutboundServerProtocol, RoutingServerProtocol, SolutionControlServerProtocol, StatServerProtocol, TServerProtocol, UcsClusterProtocol, UniversalContactServerProtocol, UrsCustomProtocol, WebmediaChannel

public interface RequestChannel
extends Channel


Field Summary
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
 
Method Summary
 RequestFuture beginRequest(Message message)
          Starts request and exits.
 Message endRequest(RequestFuture future)
          Tries to finish request started with beginRequest().
 Message endRequest(RequestFuture future, long timeout)
          Tries to finish request started with beginRequest().
 boolean getCopyResponse()
          Is response to request() copied to receive queue.
 Message request(Message message)
          Sends the message and waitResponse for response.
 Message request(Message message, long timeout)
          Sends the message and waitResponse for response or while specified timeout is elapsed.
<A> void
requestAsync(Message message, A attachment, CompletionHandler<Message,? super A> handler)
          Starts request and exits.
<A> void
requestAsync(Message message, A attachment, CompletionHandler<Message,? super A> handler, long timeout)
          Starts request and exits.
 void setCopyResponse(boolean copyResponse)
          Is response to request() copied to receive queue.
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel
close, close, getTimeout, open, open, setTimeout
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel
beginClose, beginOpen, getState
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport
addChannelListener, removeChannelListener
 

Method Detail

request

Message request(Message message)
                throws ProtocolException,
                       java.lang.IllegalStateException
Sends the message and waitResponse for response. Time to waitResponse is set by "timeout" property. Only referenceable messages can be awaited, so if message doesn't support referencing there will be no waiting and null will be returned.

Parameters:
message - Message to send
Returns:
Response message or null if no response implied
Throws:
java.lang.NullPointerException - if request message is null
java.lang.IllegalStateException - if channel is not in an appropriate state (e.g. closed)
ProtocolException - if some protocol problems occurred
See Also:
request(Message, long)

request

Message request(Message message,
                long timeout)
                throws ProtocolException,
                       java.lang.IllegalStateException
Sends the message and waitResponse for response or while specified timeout is elapsed. Only referenceable messages can be awaited, so if message doesn't support referencing there will be no waiting and null will be returned.

Parameters:
message - Message to send
timeout - timeout in ms
Returns:
Response message or null if no response implied
Throws:
java.lang.NullPointerException - if request message is null
java.lang.IllegalStateException - if channel is not in an appropriate state (e.g. closed)
ProtocolException - if some protocol problems occurred

beginRequest

RequestFuture beginRequest(Message message)
                           throws ProtocolException,
                                  java.lang.IllegalStateException
Starts request and exits. To waitResponse for request result you can use either returned RequestFuture or endRequest(RequestFuture) method.

Parameters:
message - message to request with
Returns:
future object which allow to get result of the request
Throws:
java.lang.NullPointerException - if request message is null
java.lang.IllegalStateException - if channel is in inappropriate state to execute the request
ProtocolException - if sending of the request fails
See Also:
Channel.setTimeout(long), requestAsync(Message, Object, CompletionHandler), endRequest(RequestFuture)

requestAsync

<A> void requestAsync(Message message,
                      A attachment,
                      CompletionHandler<Message,? super A> handler)
                  throws ProtocolException,
                         java.lang.IllegalStateException
Starts request and exits. Server response, cancellation or timeout notification will be delivered to the specified callback.

Type Parameters:
A - user callback attachment parameter type
Parameters:
message - message to request with
attachment - user defined parameter for the "callback"
handler - user defined "callback" interface for notification about server response
Throws:
java.lang.NullPointerException - if request message is null
java.lang.IllegalArgumentException - if callback is not null, but protocol has no positive timeout set
java.lang.IllegalStateException - if channel is in inappropriate state to execute the request
ProtocolException - if sending of the request fails
See Also:
Channel.setTimeout(long), requestAsync(Message, Object, CompletionHandler, long)

requestAsync

<A> void requestAsync(Message message,
                      A attachment,
                      CompletionHandler<Message,? super A> handler,
                      long timeout)
                  throws ProtocolException,
                         java.lang.IllegalStateException
Starts request and exits. Server response, cancellation or timeout notification will be delivered to the specified callback. Usage example:
   Message    request = ...;
   ReqContext ctx     = ...;

   CompletionHandler<Message, ReqContext> rqCallback =
           new CompletionHandler<Message, ReqContext>() {
               public void completed(
                       final Message response,
                       final ReqContext ctx) {
                   // handle the response
               }
               public void failed(
                       final Throwable throwable,
                       final ReqContext ctx) {
                   // handle the request failure
               }
           };

   protocol.requestAsync(request, ctx, rqCallback, timeout);
 

Type Parameters:
A - user callback attachment parameter type
Parameters:
message - message to request with
attachment - user defined parameter for the "callback"
handler - user defined "callback" interface for notification about server response
timeout - timeout waiting for server response before request invalidation
Throws:
java.lang.NullPointerException - if request message is null
java.lang.IllegalArgumentException - if callback is not null, but provided timeout is not positive value
java.lang.IllegalStateException - if channel is in inappropriate state to execute the request
ProtocolException - if sending of the request fails

endRequest

Message endRequest(RequestFuture future)
                   throws ProtocolException
Tries to finish request started with beginRequest().

Parameters:
future - future object obtained from beginRequest()
Returns:
message if request is successful or null if there were no response
Throws:
ProtocolException - if there are protocol related problems
See Also:
beginRequest(Message)

endRequest

Message endRequest(RequestFuture future,
                   long timeout)
                   throws ProtocolException
Tries to finish request started with beginRequest().

Parameters:
future - future object obtained from beginRequest()
timeout - timeout to waitResponse for response
Returns:
message if request is successful or null if there were no response
Throws:
ProtocolException - if there are protocol related problems
See Also:
beginRequest(Message)

getCopyResponse

boolean getCopyResponse()
Is response to request() copied to receive queue.

Returns:
true if response goes to receive queue

setCopyResponse

void setCopyResponse(boolean copyResponse)
Is response to request() copied to receive queue.

Parameters:
copyResponse - true if response goes to receive queue

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.