Record Class BarrierAlignment
java.lang.Object
java.lang.Record
io.krabka.streams.columnar.barrier.BarrierAlignment
- Record Components:
group- the barrier group whose cuts the runner aligns onreader- the reader the runner pulls cuts fromlistener- the callback the runner calls when a barrier fires
public record BarrierAlignment(String group, BarrierCutReader reader, BarrierListener listener)
extends Record
Tells a group runner which barrier group to align on.
Pass one to the ColumnarRunner.group overload that takes it. The runner
then reads the group's cuts from __barrier_state, holds back every record at
or above each partition's marker offset, and fires the barrier when every assigned
partition reaches the cut. At that point it snapshots each owned partition under the
cut's epoch, commits the cut offsets, and calls the listener.
Give the reader a consumer of its own. The runner's consumer is subscribed to the topology's source topics, and the reader replaces the assignment of the consumer it drives.
Example
var alignment = BarrierAlignment.on("transactions", new BarrierCutReader(cutConsumer))
.withListener(cut -> System.out.println("epoch " + cut.epoch()));
try (var runner = ColumnarRunner.group(topology, consumer, producer,
ColumnarErrorPolicy.fail(), new FileColumnarStateStore(directory),
new ColumnarMetrics(), alignment)) {
runner.runOnce(Duration.ofSeconds(1));
}
-
Constructor Summary
ConstructorsConstructorDescriptionBarrierAlignment(String group, BarrierCutReader reader, BarrierListener listener) Rejects null components. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.group()Returns the value of thegrouprecord component.final inthashCode()Returns a hash code value for this object.listener()Returns the value of thelistenerrecord component.static BarrierAlignmenton(String group, BarrierCutReader reader) Creates an alignment with no listener.reader()Returns the value of thereaderrecord component.final StringtoString()Returns a string representation of this record class.withListener(BarrierListener newListener) Returns a copy of this alignment with another listener.
-
Constructor Details
-
BarrierAlignment
Rejects null components.- Parameters:
group- the barrier group whose cuts the runner aligns onreader- the reader the runner pulls cuts fromlistener- the callback the runner calls when a barrier fires
-
-
Method Details
-
on
Creates an alignment with no listener.- Parameters:
group- the barrier group whose cuts the runner aligns onreader- the reader the runner pulls cuts from- Returns:
- the alignment
-
withListener
Returns a copy of this alignment with another listener.- Parameters:
newListener- the callback the runner calls when a barrier fires- Returns:
- the copy
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
group
-
reader
-
listener
-