ChatHome noneShardingChatHome(
ChatBackendProperties properties,
StorageStrategy storageStrategy,
- ChatRoomServiceFactory chatRoomServiceFactory,
Clock clock)
{
return new SimpleChatHome(
storageStrategy,
- chatRoomServiceFactory,
clock,
properties.getChatroomBufferSize());
}
.forEach(shard -> chatHomes[shard] = new SimpleChatHome(
shard,
storageStrategy,
- chatRoomServiceFactory,
clock,
properties.getChatroomBufferSize()));
ShardingStrategy strategy = new KafkaLikeShardingStrategy(numShards);
public SimpleChatHome(
StorageStrategy storageStrategy,
- ChatRoomServiceFactory chatRoomServiceFactory,
Clock clock,
int bufferSize)
{
this(
null,
storageStrategy,
- chatRoomServiceFactory,
clock,
bufferSize);
}
public SimpleChatHome(
Integer shard,
StorageStrategy storageStrategy,
- ChatRoomServiceFactory chatRoomServiceFactory,
Clock clock,
int bufferSize)
{
info.getId(),
new ChatRoomData(
clock,
- chatRoomServiceFactory.create(messageFlux),
+ new InMemoryChatRoomService(messageFlux),
bufferSize));
});
this.clock = clock;
import de.juplo.kafka.chat.backend.domain.ChatHome;
import de.juplo.kafka.chat.backend.persistence.inmemory.SimpleChatHome;
+import de.juplo.kafka.chat.backend.persistence.storage.files.ChatRoomServiceFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
int bufferSize = 8;
SimpleChatHome simpleChatHome = new SimpleChatHome(
- getStorageStrategy().readChatRoomData(),
+ getStorageStrategy(),
clock,
bufferSize);
protected void stop()
{
- getStorageStrategy().writeChatRoomData(chathome.getChatRoomData());
+ getStorageStrategy().write(chathome);
}
@Test
.of(ownedShards())
.forEach(shard -> chatHomes[shard] = new SimpleChatHome(
shard,
- storageStrategy.readChatRoomData(),
+ storageStrategy,
clock,
bufferSize()));
Clock clock)
{
return new SimpleChatHome(
- storageStrategy.readChatRoomData(),
+ storageStrategy,
clock,
bufferSize());
}