@Override public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException { jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId())); } }
@Override public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException { jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId())); } }
@Override public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException { jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId())); } }
/** * get the max partition number of the changelog stream */ private void getChangeLogMaxPartitionNumber() { int maxPartitionId = 0; for (ContainerModel containerModel : containers.values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId()); } } maxPartitionNumber = maxPartitionId + 1; }
/** * get the max partition number of the changelog stream */ private void getChangeLogMaxPartitionNumber() { int maxPartitionId = 0; for (ContainerModel containerModel : containers.values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId()); } } maxPartitionNumber = maxPartitionId + 1; }
/** * get the max partition number of the changelog stream */ private void getChangeLogMaxPartitionNumber() { int maxPartitionId = 0; for (ContainerModel containerModel : containers.values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId()); } } maxPartitionNumber = maxPartitionId + 1; }
private String serializeSystemStreamPartition(SystemStreamPartition ssp) { // Create the Json string for SystemStreamPartition Map<String, String> sspMap = new HashMap<>(); sspMap.put(SYSTEM_PROP_NAME, ssp.getSystem()); sspMap.put(STREAM_PROP_NAME, ssp.getStream()); sspMap.put(PARTITION_PROP_NAME, String.valueOf(ssp.getPartition().getPartitionId())); return new String(jsonSerde.toBytes(sspMap)); }
@Override public SystemStreamPartition getPreviousSSP(SystemStreamPartition currentSystemStreamPartition, int previousPartitionCount, int currentPartitionCount) { Preconditions.checkNotNull(currentSystemStreamPartition); Preconditions.checkArgument(currentPartitionCount % previousPartitionCount == 0, String.format("New partition count: %d should be a multiple of previous partition count: %d.", currentPartitionCount, previousPartitionCount)); Partition partition = currentSystemStreamPartition.getPartition(); Preconditions.checkNotNull(partition, String.format("SystemStreamPartition: %s cannot have null partition", currentSystemStreamPartition)); int currentPartitionId = partition.getPartitionId(); int previousPartitionId = currentPartitionId % previousPartitionCount; return new SystemStreamPartition(currentSystemStreamPartition.getSystemStream(), new Partition(previousPartitionId)); } }
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) { final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition, ssp -> newGauge(String.format("%s-%s-aggr-watermark", ssp.getStream(), ssp.getPartition().getPartitionId()), 0L)); aggregate.set(time); } }
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) { final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition, ssp -> newGauge(String.format("%s-%s-aggr-watermark", ssp.getStream(), ssp.getPartition().getPartitionId()), 0L)); aggregate.set(time); } }
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) { final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition, ssp -> newGauge(String.format("%s-%s-aggr-watermark", ssp.getStream(), ssp.getPartition().getPartitionId()), 0L)); aggregate.set(time); } }
public Partition(SystemStreamPartition systemStreamPartition) { this(systemStreamPartition.getSystem(), systemStreamPartition.getStream(), systemStreamPartition.getPartition().getPartitionId()); }
@Override public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException { String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId()); jgen.writeFieldName(sspString); } }
@Override public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException { String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId()); jgen.writeFieldName(sspString); } }
@Override public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException { String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId()); jgen.writeFieldName(sspString); } }
@Override public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException { String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId()); jgen.writeFieldName(sspString); } }
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) { SystemStream systemStream = ssp.getSystemStream(); int partitionCount = getPartitionCount(systemStream); int currentPartition = ssp.getPartition().getPartitionId(); for (int i = 0; i < partitionCount; i++) { if (i != currentPartition) { OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message); collector.send(envelopeOut); } } }
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) { SystemStream systemStream = ssp.getSystemStream(); int partitionCount = getPartitionCount(systemStream); int currentPartition = ssp.getPartition().getPartitionId(); for (int i = 0; i < partitionCount; i++) { if (i != currentPartition) { OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message); collector.send(envelopeOut); } } }
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) { SystemStream systemStream = ssp.getSystemStream(); int partitionCount = getPartitionCount(systemStream); int currentPartition = ssp.getPartition().getPartitionId(); for (int i = 0; i < partitionCount; i++) { if (i != currentPartition) { OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message); collector.send(envelopeOut); } } }
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) { SystemStream systemStream = ssp.getSystemStream(); int partitionCount = getPartitionCount(systemStream); int currentPartition = ssp.getPartition().getPartitionId(); for (int i = 0; i < partitionCount; i++) { if (i != currentPartition) { OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message); collector.send(envelopeOut); } } }