public abstract class SimpleTopicLoader extends Object implements TopicLoader
This may be extended to provide Topic Load functionality for one or more TopicProvider topics.
It provides for the most typical requirements of topic load by:
a) Creating an empty Topic Load message.
b) Calling populateMessage(TopicMessage)
to set up the data in the
message as required.
c) Calling TopicClient.send(TopicMessage)
to send the message to the
client.
This can be used to create a separate loader class or simply for declaring an anonymous class within the provider.
For example:
addTopicLoader(
new SimpleTopicLoader() {
protected void populateMessage(TopicMessage message)
throws APIException {
message.put("Some Data")
}
},
"MyTopic");
Constructor and Description |
---|
SimpleTopicLoader()
Create Simple TopicLoader
|
Modifier and Type | Method and Description |
---|---|
boolean |
load(TopicClient client,
Topic topic)
Simple Implementation of
TopicLoader.load(TopicClient, Topic) |
protected abstract void |
populateMessage(TopicMessage message)
This populates a new empty Topic Load message with the topic load data.
|
public boolean load(TopicClient client, Topic topic) throws APIException
TopicLoader.load(TopicClient, Topic)
This creates a new topic load message, calls
populateMessage(TopicMessage)
to set up the data and then
calls TopicClient.send(TopicMessage)
to send the message to the
client.
load
in interface TopicLoader
client
- the Client.topic
- the Topic.APIException
- reports failure to load.protected abstract void populateMessage(TopicMessage message) throws APIException
message
- the new empty message.APIException
- if unable to populateCopyright © 2016 Push Technology Ltd. All Rights Reserved.