The classic client API will be removed in a future release.
@Deprecated public interface ServerConnection extends MessageSource
Modifier and Type | Method and Description |
---|---|
boolean |
acknowledge(TopicMessage message)
Deprecated.
Acknowledges a message that is
'Pending Acknowledgement' . |
void |
addTopicListener(TopicListener topicListener,
String... topics)
Deprecated.
Adds a
TopicListener . |
void |
addTopicListener(TopicListener topicListener,
TopicSet topics)
Deprecated.
Adds a
TopicListener . |
boolean |
close()
Deprecated.
Close client connection.
|
String |
connect()
Deprecated.
Connects to the server without subscribing to any topics.
|
String |
connect(String... topics)
Deprecated.
Connects to the server.
|
String |
connect(TopicSet topics)
Deprecated.
Connects to the server.
|
TopicMessage |
createDeltaMessage(String topicName)
Deprecated.
Creates an empty delta message.
|
TopicMessage |
createDeltaMessage(String topicName,
int capacity)
Deprecated.
Creates an empty delta message.
|
TopicMessage |
createLoadMessage(String topicName)
Deprecated.
Creates an empty load message.
|
TopicMessage |
createLoadMessage(String topicName,
int capacity)
Deprecated.
Creates an empty load message.
|
PagedTopicHandler |
createPagedTopicHandler(TopicMessage message,
PagedTopicListener listener)
Deprecated.
Creates a handler object for a 'paged' topic.
|
ServiceTopicHandler |
createServiceTopicHandler(TopicMessage message,
ServiceTopicListener listener)
Deprecated.
since 5.7 service topics have been deprecated.
|
TopicNotifyTopicHandler |
createTopicNotifyTopicHandler(TopicMessage message,
TopicNotifyTopicHandler.NotificationLevel notificationLevel,
TopicNotifyTopicListener listener)
|
TopicNotifyTopicHandler |
createTopicNotifyTopicHandler(TopicMessage message,
TopicNotifyTopicListener listener)
Deprecated.
Creates a handler object for a 'Topic Notify' topic.
|
void |
fetch(String topic,
String... headers)
Deprecated.
Fetch the current state of a set of topics.
|
void |
fetch(TopicSet topics,
String... headers)
Deprecated.
Fetch the current state of a set of topics.
|
long |
getAckTimeout()
Deprecated.
Returns the default Server ACK timeout value for the connection.
|
String |
getClientID()
Deprecated.
Returns the client identifier for the connection.
|
long |
getLastInteraction()
Deprecated.
Returns time of last interaction with the server.
|
String |
getName()
Deprecated.
Returns a name which uniquely identifies the server within the context
that the connection is being made.
|
ServerDetails |
getServerDetails()
Deprecated.
Returns the server details.
|
int |
getServerProtocolVersion()
Deprecated.
Returns the Diffusion protocol version used for this connection.
|
ServerConnectionState |
getState()
Deprecated.
Returns the current state of the connection.
|
boolean |
isConnected()
Deprecated.
Is the connection connected?
|
boolean |
isReconnected()
Deprecated.
This indicates whether the current connection represents a reconnection
of a previous connection.
|
void |
ping()
Deprecated.
Sends a ping message to the server.
|
boolean |
removeTopicListener(TopicListener topicListener)
Deprecated.
Removes a
TopicListener . |
boolean |
send(TopicMessage message)
Deprecated.
Send a message to the server.
|
void |
sendCredentials(Credentials credentials)
Deprecated.
Send credentials to the server.
|
void |
setAckListener(ServerAckListener listener)
Deprecated.
Sets a listener to receive notification of non acknowledgement of
messages sent to the server.
|
void |
setAckTimeout(long timeout)
Deprecated.
Sets the (default) Server ACK timeout value for messages sent to the
Server that require acknowledgement.
|
void |
setListener(ServerConnectionListener listener)
Deprecated.
Set listener - for use when setting after construction but before
connection.
|
void |
setPingResponseListener(ServerPingResponseListener listener)
Deprecated.
Sets a listener to receive
'ping' responses. |
void |
subscribe(String... topics)
Deprecated.
Subscribes to a set of topics.
|
void |
subscribe(TopicSet topics)
Deprecated.
Subscribes to a set of topics.
|
void |
unsubscribe(String... topics)
Deprecated.
Unsubscribes from a set of topics.
|
void |
unsubscribe(TopicSet topics)
Deprecated.
Unsubscribes from a set of topics.
|
getMessageSourceType
String getName()
ServerDetails getServerDetails()
If connected then this will return the details actually used for the connection.
String getClientID()
getClientID
in interface MessageSource
ServerConnectionState getState()
boolean isConnected()
boolean isReconnected()
connected)
and the connection is a
reconnection of a previous connection, false if the connection is
a new connection.String connect() throws AuthorisationException, APIException
AuthorisationException
- if the connection has been rejected by the
serverAPIException
- if unable to connect to the serverString connect(TopicSet topics) throws AuthorisationException, TopicInvalidException, APIException
This blocks until successfully connected after which time incoming messages will be passed to all listeners declared for the topics subscribed to.
If this is called when already connected then the supplied topics will simply be subscribed.
topics
- a set of topics/topic selectors specifying the topics to
initially subscribe to on connection. If this is null or empty
then no topics will be subscribed to on connection.TopicInvalidException
- if one or more topics in the set are
invalidly specifiedAuthorisationException
- if the connection has been rejected by the
serverAPIException
- if unable to connect to the server on its specified
host name and port numberString connect(String... topics) throws AuthorisationException, TopicInvalidException, APIException
This is effectively the same as calling connect(TopicSet)
specifying a topic set constructed from the topic list.
topics
- a set of topics/topic selectors specifying the topics to
initially subscribe to on connection. If no topics are specified
then no topics will be subscribed to on connection.TopicInvalidException
- if one or more topics in the set are
invalidly specifiedAuthorisationException
- if the connection has been rejected by the
serverAPIException
- if unable to connect to the server on its specified
host name and port numbervoid setPingResponseListener(ServerPingResponseListener listener)
'ping'
responses.
'ping' requests are sent using ping()
.
If no listener is specified then any 'ping' responses will be ignored.
listener
- the listener for 'ping' responses. Specifying null has
the effect of removing any current listener.void setAckListener(ServerAckListener listener)
This is only required if message acknowledgement is in use. i.e. messages
have setAckRequired
called before
sending them to the Server. When message acknowledgement is used then
such a listener must be set otherwise an attempt to send such a message
to the Server will fail.
listener
- the listener. Setting to null removes any current
listener.void setAckTimeout(long timeout)
The ACK timeout is the number of milliseconds allowed between sending a
message with acknowledgement required (see
TopicMessage.setAckRequired()
) and acknowledgement being received
from the Server. If acknowledgement is not received within this time then
notification will occur via the ServerAckListener
interface (see
setAckListener(ServerAckListener)
).
This value is used if the timeout value is not explicitly set for the
message using TopicMessage.setAckTimeout(long)
.
If no value is explicitly specified for the connection then a default value is assumed.
timeout
- the default ACK timeout value in millisecondslong getAckTimeout()
void subscribe(TopicSet topics) throws TopicInvalidException, APIException
This may be used at any time after connection to add to the topics subscribed to on connection.
topics
- a set of topic names and/or topic selector patterns
indicating topics to subscribe toTopicInvalidException
- if one or more topics are invalidly
specifiedAPIException
- if unable to subscribevoid subscribe(String... topics) throws TopicInvalidException, APIException
This is the same as calling subscribe(TopicSet)
with a
TopicSet
constructed from the specified topics list.
topics
- a list of topic names and/or topic selector patterns
indicating topics to subscribe to. See the user manual for full
details of how to use topic selector patterns.TopicInvalidException
- if one or more topics are invalidly
specifiedAPIException
- if unable to subscribevoid unsubscribe(TopicSet topics) throws TopicInvalidException, APIException
This may be used at any time whilst connected to reduce the set of topics that the client subscribes to.
topics
- a set of topic names and/or topic selector patterns
specifying topics to unsubscribe fromTopicInvalidException
- if one or more of the specified topic
names/selector patterns is invalidAPIException
- if unable to unsubscribe topicsvoid unsubscribe(String... topics) throws TopicInvalidException, APIException
This is the same as calling unsubscribe(TopicSet)
with a
TopicSet
constructed from the specified list.
topics
- a list of topic names and/or topic selector patterns
specifying topics to unsubscribe fromTopicInvalidException
- if one or more of the specified topic
names/selector patterns is invalidAPIException
- if unable to unsubscribe topicsvoid fetch(TopicSet topics, String... headers) throws TopicInvalidException, APIException
The state of a topic may be retrieved without the need to subscribe to the topic in question.
The state of each topic will be returned on the
ServerConnectionListener.messageFromServer(ServerConnection, TopicMessage)
method as a topic load message
which will return
true from the TopicMessage.isFetchReply()
method.
topics
- a set of topic names and/or topic selector patterns
indicating topics to fetch the state ofheaders
- a set of headers may optionally be supplied and if they
are then they will be reflected back with the fetched message
(appended to user headers on the message if there are any). These
headers may be used to supply correlation data so that the reply
can be associated with the request.TopicInvalidException
- if one or more topics are invalidly
specifiedAPIException
- if unable to fetchvoid fetch(String topic, String... headers) throws TopicInvalidException, APIException
This is the same as calling fetch(TopicSet, String...)
with a
TopicSet
constructed from the specified topics list.
topic
- topic name and/or topic selector pattern indicating topic(s)
to fetch the state of. A list of such patterns separated by ','
may be supplied if required.headers
- a set of headers may optionally be supplied and if they
are then they will be reflected back with the fetched message
(appended to user headers on the message if there are any). These
headers may be used to supply correlation data so that the reply
can be associated with the request.TopicInvalidException
- if one or more topics are invalidly
specifiedAPIException
- if unable to fetchTopicMessage createDeltaMessage(String topicName) throws MessageException
The message will have its capacity set to the value returned by
RootConfig.getDefaultDeltaMessageCapacity()
.
Note that when topic aliasing is in use then this may create a message that contains the alias rather than the full topic name and therefore such a message could only be sent on this connection.
topicName
- the topic nameMessageException
- if unable to create a new messageTopicMessage createDeltaMessage(String topicName, int capacity) throws MessageException
Note that when topic aliasing is in use then this may create a message that contains the alias rather than the full Topic name and therefore such a message could only be sent on this connection.
topicName
- the topic namecapacity
- the initial capacity of the message which should be
sufficient to hold the data and any user headers. If more is
written to the message than this then it will automatically be
extended, however there is an overhead to such extensions so for
maximum efficiency a suitable capacity should be chosen.MessageException
- if unable to create a new messageTopicMessage createLoadMessage(String topicName) throws MessageException
The message will have its capacity set to the value returned by
RootConfig.getDefaultLoadMessageCapacity()
.
topicName
- the topic nameMessageException
- if unable to create a new messageTopicMessage createLoadMessage(String topicName, int capacity) throws MessageException
topicName
- the topic namecapacity
- the initial capacity of the message which should be
sufficient to hold the data and any user headers. If more is
written to the message than this then it will automatically be
extended, however there is an overhead to such extensions so for
maximum efficiency a suitable capacity should be chosen.MessageException
- if unable to create a new messageboolean send(TopicMessage message) throws APIException
message
- - the message to sendAPIException
- if unable to send the messagevoid sendCredentials(Credentials credentials) throws APIException
credentials
- the credentialsAPIException
- if not connected or unable to send a credentials
messageboolean acknowledge(TopicMessage message) throws APIException
'Pending Acknowledgement'
.
Assuming the message is pending acknowledgement then a message of acknowledgement is sent to the server.
message
- the message to acknowledgeAPIException
- if unable to acknowledge the given messagevoid ping() throws APIException
The response will be returned via the listener set using
setPingResponseListener(ServerPingResponseListener)
.
APIException
- if unable to send ping messageboolean close()
After calling this method connect may be called again to re-establish the connection.
int getServerProtocolVersion()
long getLastInteraction()
This returns the time (in milliseconds since the epoch) of the last interaction (whether send or receive) with the server.
@Deprecated ServiceTopicHandler createServiceTopicHandler(TopicMessage message, ServiceTopicListener listener) throws APIException
See
ServiceTopicData
for details of service topics.
This would be called in response to receiving a
load
message from a service topic as
a result of subscribing to it. Note that no other messages would be
received from a service topic other than via the specified
ServiceTopicListener
.
message
- the load message received from the topiclistener
- an object that is to receive all service replies and
notificationsAPIException
- if unable to create the handlerPagedTopicHandler createPagedTopicHandler(TopicMessage message, PagedTopicListener listener) throws APIException
See PagedTopicData
for details of paged topics.
This would be called in response to receiving a
load
message from a paged topic as a
result of subscribing to it. Note that no other messages would be
received from a paged topic until the returned handler is used to
open
the topic.
message
- the load message received from the topic.listener
- an object that is to receive all notifications from the
topicAPIException
- if unable to create the handler@Deprecated TopicNotifyTopicHandler createTopicNotifyTopicHandler(TopicMessage message, TopicNotifyTopicHandler.NotificationLevel notificationLevel, TopicNotifyTopicListener listener) throws APIException
createTopicNotifyTopicHandler(TopicMessage, TopicNotifyTopicListener)
and then use
TopicNotifyTopicHandler.setNotificationDetails(TopicNotifyTopicHandler.NotificationLevel, boolean, boolean)
See TopicNotifyTopicData
for details of topic notify topics.
This would be called in response to receiving a
load
message from a topic notify
topic as a result of subscribing to it. Note that no other messages would
be received from a topic notify topic until the returned handler is used
to select notifications required.
message
- the load message received from the topicnotificationLevel
- specifies the add notification level requiredlistener
- an object that is to receive all notifications from the
topicAPIException
- if unable to create the handler.TopicNotifyTopicHandler createTopicNotifyTopicHandler(TopicMessage message, TopicNotifyTopicListener listener) throws APIException
See
TopicNotifyTopicData
for details of topic notify topics.
This would be called in response to receiving a
load
message from a topic notify
topic as a result of subscribing to it. Note that no other messages would
be received from a topic notify topic until the returned handler is used
to select notifications required. The level of notification required may
also need to be set before any selections are made.
message
- the load message received from the topiclistener
- an object that is to receive all notifications from the
topicAPIException
- if unable to create the handlervoid setListener(ServerConnectionListener listener)
listener
- The listenervoid addTopicListener(TopicListener topicListener, TopicSet topics) throws APIException
TopicListener
.
This allows inbound messages to be routed to one or more recipient
objects according to the message topic. Messages are routed to listeners
in the order that they were declared and before routing to
ServerConnectionListener.messageFromServer(ServerConnection, TopicMessage)
. Each listener will receive a different copy of the message.
A topic listener can be declared for each topic or can apply to more than
one topic by using topic selector patterns, see TopicSet
for full
details of how to use topic selector patterns. Also, any number of
listeners may be specified for any one topic or selector pattern.
Any listener can choose to consume the Message in which case it would not be passed to any other listeners.
topicListener
- the topic listenertopics
- a list of full topic names and/or topic selector patternsAPIException
- if unable to add the topic listenervoid addTopicListener(TopicListener topicListener, String... topics) throws APIException
TopicListener
.
topicListener
- the topic listener.topics
- a set of full topic names and/or topic selector patterns.APIException
- if unable to add the topic listeneraddTopicListener(TopicListener, String...)
boolean removeTopicListener(TopicListener topicListener)
TopicListener
.
All uses of the given listener are removed.
topicListener
- the topic listenerCopyright © 2016 Push Technology Ltd. All Rights Reserved.