public interface ContentUpdateFactory extends UpdateFactory
This factory supports updates for a number of different topic types and it is important that the content supplied is compatible with the topic type and the topic schema (if applicable) otherwise the update will fail.
For replace(Content)
or update(Content)
the content
supplied must always represent the new full topic state.
For apply(Content)
the content must represent a specification of
change to the topic state. This will be the delta representation according to
the topic type. This allows for the update content to only contain values for
those fields/values that have actually changed rather than all values.
The server side action is dependent upon the topic type as follows:
1) Publishing Topics with server-side state.
i.e. single value
, record
, protocol buffer
,
custom
, slave
If update(Content)
is used, the content supplied will be compared
with the current topic state and changes applied accordingly. Subscribers
will be notified only of changes to the topic (as deltas
) and if there are no changes, there would be no notifications.
If replace(Content)
is used, the current topic state is totally
replaced by the supplied content and all current subscribers will be notified
of the new state (as snapshots
).
If apply(Content)
is used, the content supplied will be applied as a
delta update to the current topic state. Subscribers will be notified only of
the delta
.
2) Stateless
Topics
The supplied content will simply be relayed to all subscribed clients.
If update(Content)
or apply(Content)
is used, subscribers
will be notified that the content is a delta
.
If replace(Content)
is used, subscribers will be notified that the
content is a snapshot
.
3) Other Topic Types
An attempt to use this update type for any other topic type would result in
an update failure at the server.
Instances of this factory can be obtained from the TopicUpdateControl
feature using TopicUpdateControl.updateFactory(Class)
, for example:
TopicUpdateControl updateControl = session.feature(TopicUpdateControl.class);
ContentUpdateFactory factory = updateControl.updateFactory(ContentUpdateFactory.class);
Modifier and Type | Method and Description |
---|---|
Update |
apply(Content content)
Create a new update which applies the delta represented by the supplied
content to the current topic state and notifies all subscribers of the
change as appropriate.
|
Update |
replace(Content content)
Create a new update which completely replaces the topic state with the
supplied content and notifies all subscribers.
|
Update |
update(Content content)
Create a new update which updates the topic to the supplied state,
compares with the previous state and sends deltas of change to
subscribers if appropriate.
|
Update update(Content content) throws IllegalArgumentException
content
- the contentIllegalArgumentException
- if content
is nullUpdate replace(Content content) throws IllegalArgumentException
content
- the contentIllegalArgumentException
- if content
is nullUpdate apply(Content content) throws IllegalArgumentException
content
- the contentIllegalArgumentException
- if content
is nullCopyright © 2016 Push Technology Ltd. All Rights Reserved.