public interface TopicClient extends ClientConnection, MessageSource
Modifier and Type | Method and Description |
---|---|
boolean |
acknowledge(TopicMessage message)
Acknowledges a Message that is
'Pending Acknowledgement' . |
Object |
attach(Object attachment)
Attaches the given object to the client.
|
Object |
attachment()
Retrieves the current attachment.
|
Credentials |
getCredentials()
Deprecated.
This method exists only to support the
AuthorisationHandler.canConnect() and
AuthorisationHandler.credentialsSupplied methods,
both of which are deprecated in favor of authentication
handlers. It will be removed in a future release. Please be
aware that we only maintain full backwards compatibility for
Classic Clients - the Credentials object returned
will give a "null" password string for any Unified Client
calls to Credentials.getPassword() . |
String |
getReference()
Returns the user defined reference value.
|
List<Topic> |
getTopics()
Returns a list of Topics that the Client is currently subscribed to.
|
boolean |
isSubscribed(Topic topic)
Indicates whether the client is currently subscribed to a given Topic.
|
void |
removeFromClientGroups()
Remove the client from any
client groups that it
participates in. |
boolean |
selectsTopic(Topic topic)
This may be used to determine whether the Client has previously
registered an interest (or subscribed to) a given Topic.
|
boolean |
send(TopicMessage message)
Send a message to the client.
|
boolean |
sendFetchReply(TopicMessage message,
List<String> headers)
Deprecated.
since 5.6. Currently a classic client can issue a fetch
request to a stateless topic, or even a topic that does not
exist. This method enables a publisher to return a reply. At
future releases this capability will be removed.
|
void |
setReference(String reference)
Allows a user defined reference to be assigned to the client.
|
void |
subscribe(Topic topic)
Subscribe the client to a specified topic.
|
boolean |
subscribe(Topic topic,
boolean force)
Deprecated.
since 5.5.
auto
subscription is always enabled so setting force=false has no
effect. Prefer subscribe(Topic) instead. |
void |
subscribe(TopicSet topicSet)
Subscribe the client to a set of topics.
|
List<Topic> |
subscribe(TopicSet topicSet,
boolean force)
Deprecated.
since 5.5.
auto
subscription is always enabled so setting force=false has no
effect. Prefer subscribe(TopicSet) instead. |
boolean |
unsubscribe(Topic topic)
Unsubscribes the client from a given Topic.
|
List<Topic> |
unsubscribe(TopicSet topicSet)
Unsubscribe client from a set of Topics.
|
close, getClientID, getConnectionType, getLastInteraction, getProtocolVersion, isConnected, isSecure, ping
getClientID, getMessageSourceType
boolean send(TopicMessage message) throws APIException
The message will only be sent if this client is subscribed to the topic identified by the message.
Since version 5.5, the subscription check is evaluated after this method
has returned. If the client is not closed and the topic exists, this
method will return true
, but the message will not be sent if the
client is not subscribed to the topic.
It is important to note that the client will receive this message inline with the stream of updates from the specified topic; this is true for both Classic and UCI clients (i.e messages sent this way will not be propagated through the UCI messaging feature).
message
- the message to send.APIException
- if unable to send the message.@Deprecated boolean sendFetchReply(TopicMessage message, List<String> headers) throws APIException
This method is not supported for Unified API clients. Messages sent to a Unified API client using this method will be discarded.
Fetch processing may be handled either by using
TopicData
or by
the publisher for the topic. When a publisher is used it is possible to
delegate the processing such that it is handled in an asynchronous manner
in which case this method may be used to return the ultimate reply.
It is also possible for a fetch request to be sent for a topic that does not exist and routed to a listener. This could also be used to send a reply for a topic that does not exist.
Acknowledgement of such messages is not supported.
message
- the message to send.headers
- a list of headers to add to the reply message being sent.
These would typically be the headers sent with the fetch request.APIException
- if unable to send the message.boolean acknowledge(TopicMessage message) throws APIException
'Pending Acknowledgement'
.
Assuming the Message is pending acknowledgement then a Message of acknowledgement is sent to the Client.
message
- the Message to acknowledgeAPIException
- if unable to acknowledge the given Message.void subscribe(Topic topic)
Diffusion 5.6 has
changed the way that subscriptions are evaluated
. When this method
returns, the new subscription may not have yet been completed.
topic
- the topic to subscribe.@Deprecated boolean subscribe(Topic topic, boolean force)
auto
subscription
is always enabled so setting force=false has no
effect. Prefer subscribe(Topic)
instead.
Passing true
for the force
parameter has the same effect
as subscribe(Topic)
.
In previous releases, automatic
subscription
of clients to new topics was optional. Calling this method
with a false
value for the force
parameter would cause
the client's subscriptions to be re-evaluated against the topic. Since
5.5, automatic subscription cannot be disabled, and calling this method
with force=false has no effect.
Diffusion 5.6 has
changed the way that subscriptions are evaluated
. When this method
returns, the new subscription may not have yet been completed.
From Diffusion 5.6, this method always returns false.
topic
- the topic to subscribe.force
- see above.void subscribe(TopicSet topicSet)
Diffusion 5.6 has
changed the way that subscriptions are evaluated
. When this method
returns, the new subscription may not have yet been completed.
topicSet
- a set of topic names or selector strings used to select
topics from the TopicTree
of the associated
TopicProvider
@Deprecated List<Topic> subscribe(TopicSet topicSet, boolean force)
auto
subscription
is always enabled so setting force=false has no
effect. Prefer subscribe(TopicSet)
instead.
Passing true
for the force
parameter has the same effect
as subscribe(Topic)
.
In previous releases, automatic
subscription
of clients to new topics was optional. Calling this method
with a false
value for the force
parameter would cause
the client's subscriptions to be re-evaluated against the topic. Since
5.5, automatic subscription cannot be disabled, and calling this method
with force=false has no effect.
Diffusion 5.6 has
changed the way that subscriptions are evaluated
. When this method
returns, the new subscriptions may not have yet been completed.
From Diffusion 5.6, this method always returns an empty list.
topicSet
- a set of Topic names or selector strings used to select
Topics from the TopicTree
of the associated
TopicProvider
force
- see above.boolean unsubscribe(Topic topic)
void
result in a future release.topic
- topic to unsubscribe.List<Topic> unsubscribe(TopicSet topicSet)
void
result in a future release.topicSet
- a set of Topic names and/or TopicSelector
patterns indicating the topics to unsubscribe.List<Topic> getTopics()
boolean isSubscribed(Topic topic)
topic
- the Topic.boolean selectsTopic(Topic topic)
A Client may have registered an interest by explicitly attempting to
subscribe to the Topic or by subscribing to a TopicSelector
pattern that would include the Topic.
The fact that a Client has registered an interest in a Topic does not
necessarily mean that it is subscribed to the Topic as the Topic may not
have existed when the Client attempted to subscribe. When a new Topic is
created then this method may be used to determine whether a Client ought
to be subscribed to it in which case it can be force subscribed using
subscribe(Topic, boolean)
.
topic
- the Topic.void removeFromClientGroups()
client groups
that it
participates in.void setReference(String reference)
reference
- the referenceString getReference()
Object attach(Object attachment)
An attached object may later be retrieved via the attachment
method. Only one object may be attached at a time; invoking
this method causes any previous attachment to be discarded. The current
attachment may be discarded by attaching null.
attachment
- The object to be attached; may be nullObject attachment()
@Deprecated Credentials getCredentials()
AuthorisationHandler.canConnect()
and
AuthorisationHandler.credentialsSupplied
methods,
both of which are deprecated in favor of authentication
handlers. It will be removed in a future release. Please be
aware that we only maintain full backwards compatibility for
Classic Clients - the Credentials
object returned
will give a "null" password string for any Unified Client
calls to Credentials.getPassword()
.Copyright © 2016 Push Technology Ltd. All Rights Reserved.