public interface TopicProperties
Modifier and Type | Interface and Description |
---|---|
static class |
TopicProperties.PersistencePolicy
The persistence policy to be applied to topics created by the service.
|
Modifier and Type | Method and Description |
---|---|
boolean |
dontRetainValue()
Returns a boolean value to specify whether a topic should not retain its
last value.
|
TopicProperties.PersistencePolicy |
getPersistencePolicy()
Returns the persistence policy for the topic.
|
String |
getTimeSeriesRetainedRange()
Returns a retained range for a time series topic.
|
String |
getTimeSeriesSubscriptionRange()
Returns a subscription range for a time series topic.
|
TopicType |
getTopicType()
Returns the topic type.
|
boolean |
isTimeSeries()
Returns the boolean value to specify if the topic is a time series
topic.
|
boolean |
publishValuesOnly()
Returns a boolean value to specify whether a topic should publish only
values.
|
TopicProperties |
withDontRetainValue(boolean dontRetainValue)
Returns a new instance of TopicProperties with the supplied boolean value to
specify whether a topic should not retain its last value.
|
TopicProperties |
withPersistencePolicy(TopicProperties.PersistencePolicy persistencePolicy)
Returns a new instance of TopicProperties with the supplied PersistencePolicy
and other existing properties.
|
TopicProperties |
withPublishValuesOnly(boolean publishValuesOnly)
Returns a new instance of TopicProperties with the supplied boolean value to
specify whether a topic should publish only values.
|
TopicProperties |
withTimeSeries(boolean isTimeSeries)
Returns a new instance of TopicProperties with the supplied boolean value to
specify if the topic is time series and other existing properties.
|
TopicProperties |
withTimeSeriesRetainedRange(String timeSeriesRetainedRange)
Returns a new instance of TopicProperties with the supplied
timeSeriesRetainedRange and other existing properties.
|
TopicProperties |
withTimeSeriesSubscriptionRange(String timeSeriesSubscriptionRange)
Returns a new instance of TopicProperties with the supplied
timeSeriesSubscriptionRange and other existing properties.
|
TopicProperties |
withTopicType(TopicType topicType)
Returns a new instance of TopicProperties with the supplied topic type and
other existing properties.
|
TopicType getTopicType()
withTopicType(TopicType)
boolean isTimeSeries()
withTimeSeries(boolean)
TopicProperties.PersistencePolicy getPersistencePolicy()
withPersistencePolicy(PersistencePolicy)
String getTimeSeriesRetainedRange()
withTimeSeriesRetainedRange(String)
String getTimeSeriesSubscriptionRange()
withTimeSeriesSubscriptionRange(String)
boolean publishValuesOnly()
withPublishValuesOnly(boolean)
boolean dontRetainValue()
withDontRetainValue(boolean)
TopicProperties withTopicType(TopicType topicType)
The supplied value will replace the configured or default
topicType, which is TopicType.JSON
.
topicType
- the topic typeTopicProperties withTimeSeries(boolean isTimeSeries)
The supplied value will replace the configured or default timeSeriesRetainedRange, which is null.
If the topic is not a time series topic, then the `timeSeriesRetainedRange` and `timeSeriesSubscriptionRange` specified for the TopicProperties will be ignored when creating the topic.
isTimeSeries
- a boolean value to specify if the topic is a time
series topicTopicProperties withPersistencePolicy(TopicProperties.PersistencePolicy persistencePolicy)
The supplied value will replace the configured or default
persistencePolicy, which is TopicProperties.PersistencePolicy.SESSION
.
persistencePolicy
- the persistence policy for topicTopicProperties withTimeSeriesRetainedRange(String timeSeriesRetainedRange)
The `timeSeriesRetainedRange` parameter configures the range of historic events retained by a time series topic.
When a new event is added to the time series, older events that fall outside the range are discarded.
The parameter value is a time series range expression string composed of one or more constraint clauses. Constraints are combined to provide a range of events from the end of the time series.
limit constraint: A limit constraint specifies the maximum number of events from the end of the time series.
last clause: A last constraint specifies the maximum duration of events from the end of the time series. The duration is expressed as an integer followed by one of the following time units. MS - milliseconds; S - seconds; H - hours.
If a range expression contains multiple constraints, the constraint that
selects the smallest range is used.
Parameter value | Meaning |
---|---|
limit 5 | The five most recent events |
last 10s | All events that are no more than ten seconds older than the latest event |
last 10s limit 5 | The five most recent events that are no more than ten seconds older than the latest event |
Range expressions are not case sensitive: `limit 5 last 10s` is equivalent to `LIMIT 5 LAST 10S`.
The supplied value will replace the configured or default timeSeriesRetainedRange, which is null. If a null value is used, a time series topic will retain the ten most recent events.
timeSeriesRetainedRange
- the timeSeriesRetainedRange for topicTopicProperties withTimeSeriesSubscriptionRange(String timeSeriesSubscriptionRange)
The `timeSeriesSubscriptionRange` parameter configures a time series topic to send a range of historic events from the end of the time series to new subscribers.
Configuring a subscription range is a convenient way to provide new subscribers with an appropriate subset of the latest events.
A larger subscription range can be configured using the `subscriptionRange` parameter. Regardless of the parameter setting, if delta streams are enabled, new subscribers will be sent at least the latest event if one exists.
If the range of events is insufficient, the subscribing session can use a range query to retrieve older events.
The value for this property is a time series range expression, following the format used for `timeSeriesRetainedRange`.
The supplied value will replace the configured or default timeSeriesSubscriptionRange, which is null. If a null value is used, the default subscription range is used. The default subscription range depends on whether the topic is configured to publish delta streams. If delta streams are enabled, new subscribers are sent the latest event if one exists. If delta streams are disabled, new subscribers are sent no events. Delta streams are enabled by default and can be disabled by setting `publishValuesOnly` to `true`.
timeSeriesSubscriptionRange
- the timeSeriesSubscriptionRange for
topicTopicProperties withPublishValuesOnly(boolean publishValuesOnly)
By default, a topic that supports delta streams will publish the difference between two values (a delta) when doing so is more efficient than publishing the complete new value.
Setting `publishValuesOnly` to `true` disables this behaviour so that deltas are never published. Doing so is usually not recommended because it will result in more data being transmitted, less efficient use of network resources, and increased transmission latency. On the other hand, calculating deltas can require significant CPU from the server or, if update streams are used, from the updating client. The CPU cost will be higher if there are many differences between successive values, in which case delta streams confer fewer benefits. If successive values are unrelated to each other, consider setting to `true`. Also consider setting to `true` if the network capacity is high and the bandwidth savings of deltas are not required.
The supplied boolean value will replace the configured or default value for `publishValuesOnly`, which is `false`.
publishValuesOnly
- the boolean value to specify whether to publish
only valuesTopicProperties withDontRetainValue(boolean dontRetainValue)
By default, a topic will retain its latest value. The latest value will be sent to new subscribers. Setting this property to `true` disables this behaviour. New subscribers will not be sent an initial value. No value will be returned for fetch operations that select the topic. This is useful for data streams where the values are only transiently valid.
Setting to `true` also disables delta streams, regardless of the `publishValuesOnly` value. If subsequent values are likely to be related, delta streams usually provide performance benefits (see `publishValuesOnly` above). Consider leaving as `false` to benefit from delta streams, even if there is no other requirement to retain the last value.
Bearing in mind the performance trade-offs of disabling delta streams, there are two reasons to consider setting to `true`. First, it stops the server and each subscribed client from keeping a copy of the value, reducing their memory requirements. Second, when a topic has a high update rate and is replicated across a cluster, it can significantly improve throughput because the values need not be persisted to the cluster.
The supplied boolean value will replace the configured or default value for `dontRetainValue`, which is `false`.
dontRetainValue
- the boolean value to specify whether a topic
should not retain its last valueCopyright © 2024 DiffusionData Limited. All rights reserved.