{
private final Consumer<String, MessageTo> consumer;
private final String topic;
- private final long[] offsets;
+ // private final long[] offsets; Erst mal immer alles neu einlesen
private final Map<UUID, ChatRoom>[] chatrooms;
log.debug("Creating KafkaChatHomeService");
this.consumer = consumer;
this.topic = topic;
- this.offsets = new long[numShards];
- this.chatrooms = new Map<>[numShards];
- for (int i=0; i< numShards; i++)
- {
- this.offsets[i] = 0l;
- this.chatrooms[i] = chat
- }
- this.chatrooms = new Map[numShards];
+ // this.offsets = new long[numShards];
+ // for (int i=0; i< numShards; i++)
+ // {
+ // this.offsets[i] = 0l;
+ // }
this.chatrooms = new Map[numShards];
}
}
int partition = tp.partition();
- long unseenOffset = offsets[partition];
+ long unseenOffset = 0; // offsets[partition];
log.info(
"Loading messages from partition {}: start-offset={} -> current-offset={}",
partition,
unseenOffset,
currentOffset);
+
+ consumer.seek(tp, unseenOffset);
+ chatrooms[partition]
+ .values()
+ .stream()
handlers[partition] = new ChatRoomLoadingMessageHandlingStrategy(tp, currentOffset, unseenOffset);
});
}