com.genesyslab.platform.routing.protocol
Class RoutingServerProtocol
java.lang.Object
com.genesyslab.platform.commons.protocol.AbstractChannel
com.genesyslab.platform.commons.protocol.DuplexChannel
com.genesyslab.platform.commons.protocol.ClientChannel
com.genesyslab.platform.routing.protocol.RoutingServerProtocol
- All Implemented Interfaces:
- AsyncChannel, AsyncChannelOperations, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, LogMessageFilterSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel, RoutingServerProtocolHandshakeOptions
@ProtocolDescription.Tag(sdkName="Routing",
protocolName="RoutingServer")
public class RoutingServerProtocol
- extends ClientChannel
- implements RoutingServerProtocolHandshakeOptions
Use a RoutingServerProtocol
object to establish
communication between a client application and Universal Routing Server.
Here is a sample of how to establish communication with URS:
RoutingServerProtocol routingServerProtocol =
new RoutingServerProtocol(
new Endpoint(
routingServerEPName,
host,
port));
routingServerProtocol.setClientName(clientName);
routingServerProtocol.setClientType(ClientType.Generic);
routingServerProtocol.open();
When you are finished communicating with the server, you can close the
channel like this:
routingServerProtocol.close();
Note: Starting from Platform SDK 8.5.0 version, main protocol channel classes
(including RoutingServerProtocol
) are no longer "final
".
It helps with applications unit testing.
At the same time it opens access and allows to override protocols internal protected staff
from custom child classes.
Changes or extensions of the protocols functionality in child classes must be done very carefully
with clear understanding of affected components and functionality.
Also, protected PSDK methods and elements are not a part of public API, and may be a subject
for changes without special notice. So, application, which uses or overrides internal/protected
staff, may have compatibility issues on PSDK update.
Method Summary |
protected void |
doSend(Message message)
Sends the message unconditionally. |
java.lang.String |
getClientName()
Returns client name for the Universal Routing Server connection handshake. |
java.lang.Integer |
getClientNumber()
Client registration number from the Universal Routing Server side.
This value is initialized from the Universal Routing Server on handshake procedure.
It is null if the protocol connection is not opened. |
ClientType |
getClientType()
Returns client type for the Universal Routing Server connection handshake. |
protected void |
onClose(ConnectionClosedEvent event)
|
protected void |
onOpen()
This method is called when channel is opened and just about
to call event handler. |
protected void |
onReceiveMessage(Message message)
Gives to subclass a chance to perform some operations on incoming
message arrival before delivering it to connection user code. |
void |
setClientName(java.lang.String name)
Sets the Universal Routing Server client name for connection handshake procedure. |
void |
setClientType(ClientType type)
Sets the Universal Routing Server client type for connection handshake procedure. |
Methods inherited from class com.genesyslab.platform.commons.protocol.ClientChannel |
beginClose, beginOpen, beginRequest, close, close, closeAsync, closeAsync, disableConnectionOperations, doBeginRequest, doBeginRequest, doRequest, endRequest, endRequest, fireUnsolicitedEvents, getCopyResponse, getInvoker, getOpenTimeoutException, getReferenceBuilder, onSend, onUnexpectedHandshakeMessage, open, openAsync, openAsync, request, request, requestAsync, requestAsync, setAddressResolver, setAddressResolverParams, setAddressResolverParams, setCopyResponse, setEndpoint, setHandshakeFinished, setHandshakePhase, setHandshakeUnsolicitedEventsPassLimit, setRegistrationHandler, setState, submitRegMessage, throwOnUnReferenceableRequest |
Methods inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel |
addListener, applyConfiguration, cancelCloseTimeout, cancelOpenTimeout, clearInput, close, closeAsync, createChannelClosedEvent, createConnection, createConnectionClosedEvent, doBeginClose, doClose, downgradeConnection, getDefaultRestriction, getEnpointPrefixInfo, getInputSize, getInterceptor, getLocalEndPoint, getLocalEndpointInfo, getLogMessageFilter, getProtocolDescription, getProtocolFactory, getProtocolId, getRemoteEndPoint, getTimeoutException, initPackager, isMessageAllowed, notifyWithObject, onFireClosed, onFireErrorEvent, onFireOpened, open, openAsync, openAsync, processClose, processCloseAll, receive, receive, receivedMessage, releaseReceivers, removeListener, resetReceiver, resumeReading, send, setConnectionInvoker, setExternalTransport, setInputSize, setLogMessageFilter, setMessageHandler, setProtocolData, setReceiver, startUpgradeConnection, stopReading, toString, triggerWithObject, upgradeConnection, waitForObject |
Methods inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
addChannelListener, configure, connectionContext, copyTLSSettings, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getListenerHelper, getServerContext, getState, getStateMods, getTimeout, internal, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setInvoker, setServerContext, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PROTOCOL_DESCRIPTION
public static final ProtocolDescription PROTOCOL_DESCRIPTION
- Protocol signature (sdk and name) for this Channel.
RoutingServerProtocol
public RoutingServerProtocol()
- Creates instance of RoutingServerProtocol.
RoutingServerProtocol
public RoutingServerProtocol(Endpoint endpoint)
- Creates instance of RoutingServerProtocol.
- Parameters:
endpoint
- Parameters of the connection to create
setClientName
public void setClientName(java.lang.String name)
- Sets the Universal Routing Server client name for connection handshake procedure.
Usually it represents application name of this Universal Routing Server client.
- Specified by:
setClientName
in interface RoutingServerProtocolHandshakeOptions
- Parameters:
name
- client name
getClientName
public java.lang.String getClientName()
- Returns client name for the Universal Routing Server connection handshake.
Usually it represents application name of this Universal Routing Server client.
- Specified by:
getClientName
in interface RoutingServerProtocolHandshakeOptions
- Returns:
- client name
- See Also:
setClientName(String)
setClientType
public void setClientType(ClientType type)
- Sets the Universal Routing Server client type for connection handshake procedure.
- Specified by:
setClientType
in interface RoutingServerProtocolHandshakeOptions
- Parameters:
type
- client type
getClientType
public ClientType getClientType()
- Returns client type for the Universal Routing Server connection handshake.
- Specified by:
getClientType
in interface RoutingServerProtocolHandshakeOptions
- Returns:
- client type
- See Also:
setClientType(ClientType)
getClientNumber
public java.lang.Integer getClientNumber()
- Client registration number from the Universal Routing Server side.
This value is initialized from the Universal Routing Server on handshake procedure.
It is null if the protocol connection is not opened.
- Specified by:
getClientNumber
in interface RoutingServerProtocolHandshakeOptions
- Returns:
- client number or null
onOpen
protected void onOpen()
throws ProtocolException
- Description copied from class:
DuplexChannel
- This method is called when channel is opened and just about
to call event handler. You usually will need to add some logic
here and call super.onOpen() at the end of your method.
Please note, that calling super.onOpen() on the thread other
then open() was called will most probably result in deadlock
for some scenarios (like calling close() inside of onChannelOpened())
- Overrides:
onOpen
in class ClientChannel
- Throws:
ProtocolException
- if there are problems during
post open operations (e.g. registration)
onClose
protected void onClose(ConnectionClosedEvent event)
- Overrides:
onClose
in class DuplexChannel
doSend
protected void doSend(Message message)
throws ProtocolException
- Description copied from class:
DuplexChannel
- Sends the message unconditionally. Doesn't check channel state.
Use with caution. Intended for using in registration process.
- Overrides:
doSend
in class DuplexChannel
- Parameters:
message
- message to send
- Throws:
ProtocolException
- In the case of an unrecoverable protocol error. Client applications should not
try to deal with these exceptions, except for logging or displaying to users or technical administrators.
Check the exception cause for more details.
onReceiveMessage
protected void onReceiveMessage(Message message)
- Description copied from class:
DuplexChannel
- Gives to subclass a chance to perform some operations on incoming
message arrival before delivering it to connection user code.
We don't use AsyncInvoker here, because the message handling
in this class probably doesn't worth it - this method is quick and
shouldn't load connection thread too much. But if this method is
overridden in some classes and contains some long-running logic,
consider using AsyncInvoker
- Overrides:
onReceiveMessage
in class ClientChannel
- Parameters:
message
- received message
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.