Interface UpdateStream.Builder
- Enclosing interface:
- UpdateStream<T>
update stream
to use for updating a
specific topic. A builder is created using
TopicUpdate.newUpdateStreamBuilder()
.
The type of the topic being updated must match the type derived from the
valueClass
parameter.
- Since:
- 6.9
-
Method Summary
Modifier and TypeMethodDescription<T> UpdateStream<T>
Creates anUpdateStream
to use for updating a specific topic.<T> RecoverableUpdateStream<T>
build
(String path, Class<T> valueClass, RetryStrategy strategy) Creates aRecoverableUpdateStream
to use for updating a specific topic.constraint
(UpdateConstraint updateConstraint) Specifies an update constraint for this update stream.reset()
Resets the builder to its default parameters.specification
(TopicSpecification topicSpecification) Specifies a TopicSpecification for this update stream.suppressDeltas
(boolean suppressDeltas) Specifies if delta compression should be disabled for this update stream.
-
Method Details
-
specification
Specifies a TopicSpecification for this update stream.If a topic does not exist at the
path
one will be created using thetopicSpecification
when the update stream is validated. If a topic does exist, its specification must matchtopicSpecification
, otherwise the operation will fail withIncompatibleTopicException
.Specification is null by default. Calling this method with a null parameter removes the specification for this builder.
- Parameters:
topicSpecification
- the required specification of the topic- Returns:
- this builder
-
constraint
Specifies an update constraint for this update stream.Constraints can be created using
Diffusion.updateConstraints()
}.Constraints can be applied to the setting of a value and creation of an update stream. Constraints describe a condition that must be satisfied for the operation to succeed. The constraints are evaluated on the server. The available constraints are: an active session lock, the absence of a topic, the current value of the topic being updated, and a part of the current value of the topic being updated.
Constraint is Unconstrained by default. Calling this method with a null parameter resets the constraint for this builder.
- Parameters:
updateConstraint
- the constraint that must be satisfied for the update stream to be validated- Returns:
- this builder
-
suppressDeltas
Specifies if delta compression should be disabled for this update stream.This is
false
by default, i.e. delta compression is enabled.Disabling delta compression can reduce the CPU workload at the client at the cost of increased bandwidth and possible additional CPU load on the server (if the topic publishes deltas). This may be particularly useful for topics that have PUBLISH_VALUES_ONLY set.
- Parameters:
suppressDeltas
- the boolean value to set the suppression of delta compression.- Returns:
- this builder
- Since:
- 6.11
-
reset
UpdateStream.Builder reset()Resets the builder to its default parameters.- Returns:
- this builder
-
build
Creates anUpdateStream
to use for updating a specific topic.The type of the topic being updated must match the type derived from the
valueClass
parameter.Update streams send a sequence of updates for a specific topic. The updates may be delivered to the server as binary deltas. They do not provide exclusive access to the topic. If exclusive access is required update streams should be used with
session locks
as constraints.Streams are validated lazily when the first
UpdateStream.set(T)
orUpdateStream.validate()
operation is completed. Once validated a stream can be invalidated, after which it rejects future updates.- Type Parameters:
T
- type of the values expected by the update stream- Parameters:
path
- the path of the topicvalueClass
- the type of the values expected by the update stream- Returns:
- an update stream
-
build
Creates aRecoverableUpdateStream
to use for updating a specific topic.Takes a retry strategy that governs recovery attempts following a recoverable exception. In other respects this method works in the same way as
build(String, Class)
.- Type Parameters:
T
- type of the values expected by the update stream- Parameters:
path
- the path of the topicvalueClass
- the type of the values expected by the update streamstrategy
- the retry strategy to apply- Returns:
- a recoverable update stream
- Since:
- 6.10
-