demos/kafka/chat
14 months agoWIP:sharding-in-implementation sharding
Kai Moritz [Sun, 26 Feb 2023 13:28:47 +0000 (14:28 +0100)]
WIP:sharding-in-implementation

14 months agoWIP
Kai Moritz [Sat, 18 Feb 2023 09:25:23 +0000 (10:25 +0100)]
WIP

14 months agoWIP
Kai Moritz [Fri, 17 Feb 2023 18:27:09 +0000 (19:27 +0100)]
WIP

14 months agoWIP
Kai Moritz [Fri, 17 Feb 2023 18:12:27 +0000 (19:12 +0100)]
WIP

14 months agoWIP
Kai Moritz [Fri, 17 Feb 2023 18:11:02 +0000 (19:11 +0100)]
WIP

14 months agoWIP
Kai Moritz [Fri, 17 Feb 2023 18:07:11 +0000 (19:07 +0100)]
WIP

14 months agoWIP
Kai Moritz [Wed, 25 Jan 2023 21:58:54 +0000 (22:58 +0100)]
WIP

14 months agoWIP
Kai Moritz [Wed, 25 Jan 2023 21:56:20 +0000 (22:56 +0100)]
WIP

14 months agoWIP
Kai Moritz [Sun, 22 Jan 2023 17:13:40 +0000 (18:13 +0100)]
WIP

14 months agorefactor: Pushed sharding one layer down in the architecture
Kai Moritz [Fri, 24 Feb 2023 08:47:35 +0000 (09:47 +0100)]
refactor: Pushed sharding one layer down in the architecture

- The packages `domain` and `api` does not have to know anything about
  sharding.
- This is a preparation for the implementation of a persistence
  implementation, that is based on Kafka.
- Also simplifies the configuration in `InMemoryServiceConfiguration`.

14 months agotest: Proofed, that there is an NPE in `ShardedChatHome.getChatRoom()`
Kai Moritz [Sat, 18 Feb 2023 10:07:21 +0000 (11:07 +0100)]
test: Proofed, that there is an NPE in `ShardedChatHome.getChatRoom()`

- Refined `AbstractConfigurationIT` to show, that an NPE can occure in
  `ShardedChatHome.getChatRoom()`.
- Defined the expected behaviour, if the NPE is handled correctly in the
  refined integration-test.

14 months agorefactor: Refined the creation of new `ChatRoom`s
Kai Moritz [Fri, 17 Feb 2023 23:21:50 +0000 (00:21 +0100)]
refactor: Refined the creation of new `ChatRoom`s

- Dropped `ChatHomeService.putChatRoom(ChatRoom)`.
- `ChatRoomFactory.create(UUID, String)` returns `ChatRoomInfo`.

14 months agorefactor: DRY for the configuration of the `AbstractStorageStrategyIT`
Kai Moritz [Fri, 17 Feb 2023 23:10:03 +0000 (00:10 +0100)]
refactor: DRY for the configuration of the `AbstractStorageStrategyIT`

14 months agorefactor: Refined the configuration of `AbstractStorageStrategyIT'
Kai Moritz [Fri, 17 Feb 2023 22:34:55 +0000 (23:34 +0100)]
refactor: Refined the configuration of `AbstractStorageStrategyIT'

15 months agorefactor: `ChatRoomService.persistMessage(..)` returns a `Mono<Message>`
Kai Moritz [Tue, 24 Jan 2023 18:05:18 +0000 (19:05 +0100)]
refactor: `ChatRoomService.persistMessage(..)` returns a `Mono<Message>`

15 months agorefactor: Simplified the handling of `MessageMutationException`
Kai Moritz [Wed, 25 Jan 2023 21:08:11 +0000 (22:08 +0100)]
refactor: Simplified the handling of `MessageMutationException`

15 months agotest: Added a test that assers disjunct chatrooms
Kai Moritz [Sun, 22 Jan 2023 17:34:21 +0000 (18:34 +0100)]
test: Added a test that assers disjunct chatrooms

15 months agochore: Added a Docker-Build
Kai Moritz [Sun, 15 Jan 2023 18:48:34 +0000 (19:48 +0100)]
chore: Added a Docker-Build

15 months agofeat: Reintroduced `ChatRoom.shard`, becaus it is needed as a routing-hint
Kai Moritz [Sat, 14 Jan 2023 18:53:16 +0000 (19:53 +0100)]
feat: Reintroduced `ChatRoom.shard`, becaus it is needed as a routing-hint

- Technically, the attribute is not needed.
- But, to implement the gua/sha-pattern, it is needed as routing-hing.
- Hence, it is reintroduced here and also added to the `ChatRoomTo` to
  be send to the client.

15 months agofix: Fixed a NPE in `ShardedChatHome.getChatRooms()`
Kai Moritz [Sat, 14 Jan 2023 17:09:46 +0000 (18:09 +0100)]
fix: Fixed a NPE in `ShardedChatHome.getChatRooms()`

- When collecting the `ChatRoom`s for all shards, unused shards with a
  `null` value were not skipped.
- Also added log-messages of level `INFO` for the creation of `ChatRoom`,
  `SimpleChatHome` and `ShardedChatHome`.

15 months agofix: Removed unnecessary generic in `ChatHomeService`
Kai Moritz [Sat, 14 Jan 2023 17:11:56 +0000 (18:11 +0100)]
fix: Removed unnecessary generic in `ChatHomeService`

15 months agochore: Switched the default-configuration to sharding `none`
Kai Moritz [Sat, 14 Jan 2023 16:40:21 +0000 (17:40 +0100)]
chore: Switched the default-configuration to sharding `none`

15 months agorefactor: A `ChatRoom` does not have to remember its shard any more
Kai Moritz [Sat, 14 Jan 2023 16:33:02 +0000 (17:33 +0100)]
refactor: A `ChatRoom` does not have to remember its shard any more

- The shard of a `ChatRoom` can be derived from its ID, if the configured
  `ShardingStrategy` is known.
- Because the `ShardingStrategy` is known everywhere, where the shard of a
  `ChatRoom` is needed, it always can be derived dynamically.

15 months agorefactor: Pulled business-logic into class `ShardedChatHome`
Kai Moritz [Sat, 14 Jan 2023 15:47:04 +0000 (16:47 +0100)]
refactor: Pulled business-logic into class `ShardedChatHome`

- Pulled the logic that selects the appropriate shard from the class
  `ChatBackendController` into the newly introduced class
  `ShardedChatHome`.
- Simplified the configuration
  - `InMemoryServicesConfiguration` creates a `ChatHome` of type
    `SimpleChatHome`, if the `sharding-strategy` `none` is choosen.
  - In that case, the values for `num-shards` and `owned-shards` are
    ignored and set to `1` and `0`.
  - If the `sharding-strategy` is set to `kafkalike`, a `ChatHome` of
    type `ShardedChatHome` is instanciated and the configuration
    respects the configured sharding.
- Simplified the configuration of `ChatBackendControllerTest` accordingly.

15 months agorefactor: Made `SimpleChatHome` an implementation of `ChatHome`
Kai Moritz [Sat, 14 Jan 2023 15:07:04 +0000 (16:07 +0100)]
refactor: Made `SimpleChatHome` an implementation of `ChatHome`

15 months agorefactor: Removed `ChatHomeFactory`
Kai Moritz [Sat, 14 Jan 2023 15:01:55 +0000 (16:01 +0100)]
refactor: Removed `ChatHomeFactory`

- `ChatHomeFactory` was only used during initialization.
- By moving the instanciation of `chatHomes` into the implementation-
  specific configuration, the necessity of the factory vanished.

15 months agofeat: Introduced a kafka-like `ShardingStrategy` for `inmemory`
Kai Moritz [Fri, 13 Jan 2023 23:05:31 +0000 (00:05 +0100)]
feat: Introduced a kafka-like `ShardingStrategy` for `inmemory`

- Introduced the `ShardingStrategy`, that picks a shard for a given
  `ChatRoom`-ID.
  - Implemented a `KafkaLikeShardingStrategy`, that reuses the hashing
    algorithm, that is implementd in `Utils.murmur2()` in the
    `org.apache.kafka:kafka-clients` library.
  - The attribute `shard` of the `ChatHome` has to be restored according
    to the configured `ShardingStrategy` when loading the state - it must
    not be safed with the stored data, because it might change due to
    configuration-changes.
- The `ChatBackendController` was not configured correctly, because it
  had consumed the single `ChatHome` from the old configuration as the
  only entry in its `ChatHome[]`-array.
  - Refined the application-properties: Introduced an inner subclass
    `InMemoryServicesProperties` of `ChatBackendProperties`, that
    encapsulates the properties, that only concern the implementation
    `inmemory`.
  - Added the configuration-parameters `numShards` and `ownedShards`,
    that are needed by `inmemory`, to handle the sharding correctly.
- Introduced `ChatHomeFactory`, because the `ChatHome`s are instanciated
  by `ChatBackendConfiguration`, which is not aware of the configured
  implementation.
- Adjusted the test-cases to the changes.
- Added `InMemoryWithFilesAndShardingConfigurationIT`, that asserts,
  that the application works as expected, if sharding is activated.

15 months agotest: Streamlined the config-IT, so that they use the same expectations
Kai Moritz [Fri, 13 Jan 2023 20:44:02 +0000 (21:44 +0100)]
test: Streamlined the config-IT, so that they use the same expectations

- Both tests now use the same data and expect the same results.
- Moved the actual tests and assertions to `AbstractConfigurationIT`.
- Also streamlined `AbstractStorageStrategyIT`, so that it produces
  the exact same data, that the configuration-tests are expecting.
  This is not a necessary change to get the refined coniguration-tests
  running. It just makes it easier, to produce the needed test-data for
  future refinements.
- Also streamlined the naming of the directory, where
  `InMemoryWithFilesStorageIT` stores its data.

15 months agorefactor: Tried to simplify & clearify the naming of the integration-tests
Kai Moritz [Fri, 13 Jan 2023 20:29:29 +0000 (21:29 +0100)]
refactor: Tried to simplify & clearify the naming of the integration-tests

15 months agorefactor: DRY für shard-selection
Kai Moritz [Fri, 13 Jan 2023 19:37:36 +0000 (20:37 +0100)]
refactor: DRY für shard-selection

15 months agofeat: Prepared the application for sharding
Kai Moritz [Thu, 12 Jan 2023 22:40:12 +0000 (23:40 +0100)]
feat: Prepared the application for sharding

- The `ChatBackendController` stores the `ChatHome`s in an array.
- Reintroduced a `ChatRoomFactory`

15 months agotest: Added integration-test `InMemoryWithMongoDbStorageIT`
Kai Moritz [Wed, 11 Jan 2023 22:07:42 +0000 (23:07 +0100)]
test: Added integration-test `InMemoryWithMongoDbStorageIT`

15 months agofix: Supressed mongo-autoconfiguration if `FilesStorageStrategy` is active
Kai Moritz [Thu, 12 Jan 2023 21:58:56 +0000 (22:58 +0100)]
fix: Supressed mongo-autoconfiguration if `FilesStorageStrategy` is active

15 months agorefactor: Renamed the test to `InMemoryWithFilesStorageIT`
Kai Moritz [Thu, 12 Jan 2023 22:06:10 +0000 (23:06 +0100)]
refactor: Renamed the test to `InMemoryWithFilesStorageIT`

15 months agofeat: Refined `ChatBackendApplicationTest`
Kai Moritz [Wed, 11 Jan 2023 20:55:07 +0000 (21:55 +0100)]
feat: Refined `ChatBackendApplicationTest`

- Switched to a full server-startup (no MockMvc).
- Added some requests, that check the availability of the expected data.

15 months agorefactor: refined the endpoint-uri's
Kai Moritz [Wed, 11 Jan 2023 20:41:46 +0000 (21:41 +0100)]
refactor: refined the endpoint-uri's

15 months agofeat: Introduced config switches to choose the used implementations
Kai Moritz [Wed, 11 Jan 2023 18:09:53 +0000 (19:09 +0100)]
feat: Introduced config switches to choose the used implementations

- Switched the existing `@Configuration`-classes into an auto-configuration.
- Added a `@ConditionalOnProperty`, that loades the default-configuration.
- Added an Auto-Configuration for the `MongoDbStorageStrategy`, which is
  inactive by default and can be switched on by the property
  `chat.backend.storage` to `mongodb`.

15 months agofeat: configuration for service & storage lives in the according packages
Kai Moritz [Wed, 11 Jan 2023 17:38:39 +0000 (18:38 +0100)]
feat: configuration for service & storage lives in the according packages

15 months agotest: Activated the maven-failsafe-plugin
Kai Moritz [Tue, 10 Jan 2023 23:18:24 +0000 (00:18 +0100)]
test: Activated the maven-failsafe-plugin

15 months agofix: Added constraints for valid usernames
Kai Moritz [Tue, 10 Jan 2023 22:59:36 +0000 (23:59 +0100)]
fix: Added constraints for valid usernames

- This fix is necessary, because not all usernames can be stored in
  the newly introduced `MongoDbStorageStrategy`.

15 months agofeat: Implemented and tested `MongoDbStorageStrategy`
Kai Moritz [Mon, 9 Jan 2023 21:49:44 +0000 (22:49 +0100)]
feat: Implemented and tested `MongoDbStorageStrategy`

- Beware: The version 4.0.0 of Spring Data MongoDB that is included in
  Spring Boot 3.0.x does not work with version 4.8.1 of the MongoDB drivers
  that are included. Therefore, the version of the drivers was downgraded
  to 4.7.2 - See:
  https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#compatibility.matrix
- Also tried an upgrade of Spring Boot from 3.0.0 to 3.0.1, but without
  luck.
- Beware: Spring Boot 3.x does not include an autoconfigured embedded
  version of MongoDB for testing. It removed the autoconfiguration for
  `de.flapdoodle.embed:de.flapdoodle.embed.mongo` !

15 months agorefactor: Refined (simplified) `StorageStrategy`
Kai Moritz [Mon, 9 Jan 2023 21:46:42 +0000 (22:46 +0100)]
refactor: Refined (simplified) `StorageStrategy`

15 months agorefactor: Moved `FilesStorageStrategy` in its own package -- Rename
Kai Moritz [Mon, 9 Jan 2023 21:42:37 +0000 (22:42 +0100)]
refactor: Moved `FilesStorageStrategy` in its own package -- Rename

15 months agorefactor: Moved `FilesStorageStrategy` in its own package -- Move
Kai Moritz [Mon, 9 Jan 2023 21:42:11 +0000 (22:42 +0100)]
refactor: Moved `FilesStorageStrategy` in its own package -- Move

15 months agorefactor: `FileStorageStrategy` is not bound to `InMemoryChatRoomService`
Kai Moritz [Mon, 9 Jan 2023 21:35:40 +0000 (22:35 +0100)]
refactor: `FileStorageStrategy` is not bound to `InMemoryChatRoomService`

15 months agorefactor: Moved classes in package `persistence` in sub-packages -- Rename
Kai Moritz [Mon, 9 Jan 2023 21:23:35 +0000 (22:23 +0100)]
refactor: Moved classes in package `persistence` in sub-packages -- Rename

15 months agorefactor: Moved classes in package `persistence` in sub-packages -- Move
Kai Moritz [Mon, 9 Jan 2023 21:18:18 +0000 (22:18 +0100)]
refactor: Moved classes in package `persistence` in sub-packages -- Move

15 months agorefactor: Introduced `AbstractStorageStrategyIT` as base for more tests
Kai Moritz [Mon, 9 Jan 2023 20:37:55 +0000 (21:37 +0100)]
refactor: Introduced `AbstractStorageStrategyIT` as base for more tests

- Moved the test-logic, that does not depend on implementation-details
  into an abstract base-class `AbstractStorageStrategyID`.
- `LocalJsonFilesStorageStrategyIT` extends this class and only instances
  for that specific implementation and the accompanying setup.

15 months agofix: `ChatBackendApplicationTest` cannot corrupt the real data anymore
Kai Moritz [Mon, 9 Jan 2023 20:14:35 +0000 (21:14 +0100)]
fix: `ChatBackendApplicationTest` cannot corrupt the real data anymore

- The test used the default storage-direcory.
- Because the app is sometimes aborted during the shutdown, this sometimes
  lead to corrupted data in the default storage-directory.
- The test now uses a predefined set of data underneath the build-directory.
- Also changed the name of the according property to `storage-directory`.

15 months agofix: Refined `ChatBackendControllerTest` and fixed a bug in `ChatRoom`
Kai Moritz [Mon, 9 Jan 2023 19:51:20 +0000 (20:51 +0100)]
fix: Refined `ChatBackendControllerTest` and fixed a bug in `ChatRoom`

- Only `ChatHomeService` and `ChatRoomService` are mocked.
- This makes the test more robust, because there are less sources for
  false positives or wron negatives because of wrongly mocked behaviour.
- Aforementioned is proofed by an unnoticed bug, that was discoverd by
  the freshly refined test.

15 months agofeat: Moved persistence-logic from `ChatHome` into `ChatHomeService`
Kai Moritz [Mon, 9 Jan 2023 18:52:05 +0000 (19:52 +0100)]
feat: Moved persistence-logic from `ChatHome` into `ChatHomeService`

- Aligned configuration and tests accordingly.
- Also fixed some camel-case typos.

16 months agorefactor: Moved business-logic from `ChatRoomService` into `ChatRoom`
Kai Moritz [Sun, 8 Jan 2023 20:30:57 +0000 (21:30 +0100)]
refactor: Moved business-logic from `ChatRoomService` into `ChatRoom`

- Some essential business-logic -- the identification of mutated messages --
  was buried in `InMemoryChatRoomService`.
- This business-logic was moved into `ChatRoom`, becaus otherwise, it
  would have been necessary, to reproduce this logic in each and every
  new implementation of `ChatRoomService`, which would have been exhausting
  and errorprone.
- This allowed also cleaner code in `InMemoryChatRoomService`, that
  can focus on the persistence-logic.
- The implementation of `MessageMutationException` and the look of the
  accompanying problem-details hat to be refined accordingly.

16 months agofix: Asserted, that `ChatHome` acts, as expected, if asked for a `ChatRoom`
Kai Moritz [Sun, 8 Jan 2023 20:13:39 +0000 (21:13 +0100)]
fix: Asserted, that `ChatHome` acts, as expected, if asked for a `ChatRoom`

16 months agorefactor: Streamlined the API of the services
Kai Moritz [Sun, 8 Jan 2023 15:28:17 +0000 (16:28 +0100)]
refactor: Streamlined the API of the services

- `ChatRoomService` and `ChatHomeService` both return only reactive types.
- The decission stems from the wish, to become reactive all the way from
  the client to the technical implementation of the backend-services.
- This faciliates the mapping of the results in `ChatBackendController`.
- The refactoring already simplified lots of code, where a `Flux` has
  to derived from the `Stream`, yielding a good feeling about the plan,
  that is pursued with this refactoring.
- The refactoring also lead to the decision that `UnknownChatroomException`
  realy is a business-logic-exception (that according refactoring was
  already performed in the previous commits, to ceap this commit clean).

16 months agorefactor: `UnknownChatroomException` is a business-exception - Relocate
Kai Moritz [Sun, 8 Jan 2023 15:21:17 +0000 (16:21 +0100)]
refactor: `UnknownChatroomException` is a business-exception - Relocate

16 months agorefactor: `UnknownChatroomException` is a business-exception - Move
Kai Moritz [Sun, 8 Jan 2023 15:20:53 +0000 (16:20 +0100)]
refactor: `UnknownChatroomException` is a business-exception - Move

16 months agofix: Fixed generated problem-details for mutated messages
Kai Moritz [Sun, 8 Jan 2023 18:47:43 +0000 (19:47 +0100)]
fix: Fixed generated problem-details for mutated messages

16 months agofeat: Implemented problem-details for `UnknownChatroomException`
Kai Moritz [Sun, 8 Jan 2023 16:14:56 +0000 (17:14 +0100)]
feat: Implemented problem-details for `UnknownChatroomException`

- Implemented an `@ExceptionHandler` for `UnknownChatroomException`.
- Implemented `ChatBackendControllerTest`
  - Asserted, that the problem-details are generated as expected
  - Pinned down problems, that yield a refactoring and have to
    be resolved afterwards.

16 months agorefactor: Added assertj-reactor for more readability
Kai Moritz [Sun, 8 Jan 2023 15:09:30 +0000 (16:09 +0100)]
refactor: Added assertj-reactor for more readability

16 months agotest: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored
Kai Moritz [Sun, 8 Jan 2023 11:28:32 +0000 (12:28 +0100)]
test: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored

16 months agofix: Implemented a test for `MessageTo` and fixed deserialization
Kai Moritz [Sun, 8 Jan 2023 11:02:33 +0000 (12:02 +0100)]
fix: Implemented a test for `MessageTo` and fixed deserialization

16 months agotest: Implemented a first IT for `LocalJsonFilesStorageStrategy`
Kai Moritz [Sun, 8 Jan 2023 10:14:45 +0000 (11:14 +0100)]
test: Implemented a first IT for `LocalJsonFilesStorageStrategy`

- This first version of the test does not realy test the storing.
- It is only a proof-of-concept for the setup.

16 months agorefactor: The `ChatRoom` determines the timestamp of a `Message`
Kai Moritz [Sun, 8 Jan 2023 09:57:25 +0000 (10:57 +0100)]
refactor: The `ChatRoom` determines the timestamp of a `Message`

16 months agorefactore: Renamed `ChatroomService` to `ChatRoomService` -- Rename
Kai Moritz [Sun, 8 Jan 2023 09:34:09 +0000 (10:34 +0100)]
refactore: Renamed `ChatroomService` to `ChatRoomService` -- Rename

16 months agorefactore: Renamed `ChatroomService` to `ChatRoomService` -- Move
Kai Moritz [Sun, 8 Jan 2023 09:34:02 +0000 (10:34 +0100)]
refactore: Renamed `ChatroomService` to `ChatRoomService` -- Move

16 months agorefactore: Renamed `ChatroomTo` to `ChatRoomTo` -- Rename
Kai Moritz [Sun, 8 Jan 2023 09:20:56 +0000 (10:20 +0100)]
refactore: Renamed `ChatroomTo` to `ChatRoomTo` -- Rename

16 months agorefactore: Renamed `Chatroom` to `ChatRoom` -- Rename
Kai Moritz [Sun, 8 Jan 2023 09:19:47 +0000 (10:19 +0100)]
refactore: Renamed `Chatroom` to `ChatRoom` -- Rename

16 months agorefactore: Renamed `ChatroomFactory` to `ChatHomeService` -- Rename
Kai Moritz [Sun, 8 Jan 2023 09:17:49 +0000 (10:17 +0100)]
refactore: Renamed `ChatroomFactory` to `ChatHomeService` -- Rename

16 months agorefactore: Renamed `ChatroomFactory` to `ChatHomeService` -- Move
Kai Moritz [Sun, 8 Jan 2023 09:17:34 +0000 (10:17 +0100)]
refactore: Renamed `ChatroomFactory` to `ChatHomeService` -- Move

16 months agorefactore: Renamed `PersistenceStrategy` to `ChatroomService` -- Rename
Kai Moritz [Sun, 8 Jan 2023 09:10:46 +0000 (10:10 +0100)]
refactore: Renamed `PersistenceStrategy` to `ChatroomService` -- Rename

16 months agorefactore: Renamed `PersistenceStrategy` to `ChatroomService` -- Move
Kai Moritz [Sun, 8 Jan 2023 09:10:34 +0000 (10:10 +0100)]
refactore: Renamed `PersistenceStrategy` to `ChatroomService` -- Move

16 months agorefactor: Only `LocalJsonFileStorageStrategy` restores `Chatroom`s
Kai Moritz [Sun, 8 Jan 2023 08:53:03 +0000 (09:53 +0100)]
refactor: Only `LocalJsonFileStorageStrategy` restores `Chatroom`s

16 months agofeat: Added an endpoint that list all messages of a chatroom
Kai Moritz [Sat, 7 Jan 2023 23:47:22 +0000 (00:47 +0100)]
feat: Added an endpoint that list all messages of a chatroom

16 months agorefactor: `LocalJsonFilesStorageStrategy` is now realy reactive
Kai Moritz [Sat, 7 Jan 2023 20:58:27 +0000 (21:58 +0100)]
refactor: `LocalJsonFilesStorageStrategy` is now realy reactive

16 months agofix: The sink is recreated, if it gets canceled
Kai Moritz [Sat, 7 Jan 2023 01:16:57 +0000 (02:16 +0100)]
fix: The sink is recreated, if it gets canceled

- The sink is automatically cancelled, if the last consumer leaves.
- Turning auto-cancel of, is not an option, because this buffers new
  messages, until the buffer overflows, after which new messages are
  droped. Hence, if a new subscriber arrives, it would see some old
  messages and then, after a gap, current messages.
- Because of that, the sink is now automatically recreated, if the
  last subscriber leaves and triggers the automatically cancelation
  of the sink.
- The sink can be recreated without conflicts, because all methods,
  that may access the sink are synchronized.

16 months agofeat: Server sends real Server-Sent-Events
Kai Moritz [Sat, 7 Jan 2023 00:41:34 +0000 (01:41 +0100)]
feat: Server sends real Server-Sent-Events

16 months agofeat: The size buffer for listeners to a chatroom is configurable
Kai Moritz [Sat, 7 Jan 2023 20:05:30 +0000 (21:05 +0100)]
feat: The size buffer for listeners to a chatroom is configurable

16 months agofeat: Allowed the frontend as origin for CORS
Kai Moritz [Fri, 6 Jan 2023 00:45:58 +0000 (01:45 +0100)]
feat: Allowed the frontend as origin for CORS

16 months agofeat: Added a POST-mapping to force the storing of the data
Kai Moritz [Fri, 6 Jan 2023 00:33:51 +0000 (01:33 +0100)]
feat: Added a POST-mapping to force the storing of the data

16 months agorefactor: Fixed return-types of the controller
Kai Moritz [Thu, 5 Jan 2023 23:44:44 +0000 (00:44 +0100)]
refactor: Fixed return-types of the controller

- Renamed and moved `ChatroomInfo` to `ChatroomTo`
- Switched return-types from `Chatroom` to `ChatroomTo`

16 months agofix: `Chatroom`s must not share an instance of `PersistanceStrategy`
Kai Moritz [Sat, 7 Jan 2023 20:00:50 +0000 (21:00 +0100)]
fix: `Chatroom`s must not share an instance of `PersistanceStrategy`

16 months agofeat: The chats are stored as local json-files
Kai Moritz [Thu, 5 Jan 2023 15:09:04 +0000 (16:09 +0100)]
feat: The chats are stored as local json-files

16 months agofeat: `ChatHome` returns an `Optional` for `getChatroom(UUID)`
Kai Moritz [Sat, 7 Jan 2023 19:29:32 +0000 (20:29 +0100)]
feat: `ChatHome` returns an `Optional` for `getChatroom(UUID)`

16 months agofeat: Introduced `ChatHome` that gives multiple `Chatroom`s a home
Kai Moritz [Thu, 5 Jan 2023 18:18:50 +0000 (19:18 +0100)]
feat: Introduced `ChatHome` that gives multiple `Chatroom`s a home

16 months agorefactor: Moved configuration in a separate class and made it more explicit
Kai Moritz [Wed, 28 Dec 2022 18:20:51 +0000 (19:20 +0100)]
refactor: Moved configuration in a separate class and made it more explicit

16 months agorefactor: Introduced `ChatroomFactory`
Kai Moritz [Wed, 28 Dec 2022 17:09:06 +0000 (18:09 +0100)]
refactor: Introduced `ChatroomFactory`

- `ChatBackendController` only has to know of the `ChatroomFactory`.
- `ChatBackendController` does not have to know the `PersistenceStrategy`.

16 months agorefactor: Moved persistence-logic into a pluggable strategy
Kai Moritz [Wed, 28 Dec 2022 16:53:46 +0000 (17:53 +0100)]
refactor: Moved persistence-logic into a pluggable strategy

16 months agorefactor: A `Message` now explicitly has a `MessageKey`
Kai Moritz [Wed, 28 Dec 2022 16:48:01 +0000 (17:48 +0100)]
refactor: A `Message` now explicitly has a `MessageKey`

16 months agorefactor: Streamlined API of `Chatroom` - all return-types are reactive
Kai Moritz [Wed, 28 Dec 2022 16:38:00 +0000 (17:38 +0100)]
refactor: Streamlined API of `Chatroom` - all return-types are reactive

16 months agorefactor: Refined field-names of `Message` and `MessageTo`
Kai Moritz [Wed, 28 Dec 2022 16:23:30 +0000 (17:23 +0100)]
refactor: Refined field-names of `Message` and `MessageTo`

- Choosed longer and more descriptive field-names for the domain-class
  `Message`.
- Choosed short names for the TO-class `MessageTO`, which is serialized as
  JSON.

16 months agofeat: `Chatroom.getMessages()` is fully paginated (takes first and last)
Kai Moritz [Wed, 28 Dec 2022 16:20:53 +0000 (17:20 +0100)]
feat: `Chatroom.getMessages()` is fully paginated (takes first and last)

16 months agorefactor: Refined packaging (renamed packages and classes)
Kai Moritz [Wed, 28 Dec 2022 16:14:28 +0000 (17:14 +0100)]
refactor: Refined packaging (renamed packages and classes)

16 months agorefactor: Refined packaging (moved classes to new folders and files)
Kai Moritz [Wed, 28 Dec 2022 15:58:34 +0000 (16:58 +0100)]
refactor: Refined packaging (moved classes to new folders and files)

16 months agorefactor: Renamed artifact to chat-backend
Kai Moritz [Wed, 28 Dec 2022 15:55:34 +0000 (16:55 +0100)]
refactor: Renamed artifact to chat-backend

16 months agorefactor: Reworked implementation of the problem-details [RFC-7807]
Kai Moritz [Mon, 26 Dec 2022 17:07:57 +0000 (18:07 +0100)]
refactor: Reworked implementation of the problem-details [RFC-7807]

16 months agofeat: Added problem-details [RFC-7807] for a message mutation error
Kai Moritz [Mon, 26 Dec 2022 13:50:51 +0000 (14:50 +0100)]
feat: Added problem-details [RFC-7807] for a message mutation error

16 months agofeat: An `IllegalArgumentException` is thrown, if different messages are added for...
Kai Moritz [Mon, 26 Dec 2022 13:03:52 +0000 (14:03 +0100)]
feat: An `IllegalArgumentException` is thrown, if different messages are added for the same `MessageKey`

16 months agofeat: Added logging for the `listen`-endpoint
Kai Moritz [Mon, 26 Dec 2022 12:48:05 +0000 (13:48 +0100)]
feat: Added logging for the `listen`-endpoint

16 months agofix: fixed the return-type of the `listen`-endpoint
Kai Moritz [Mon, 26 Dec 2022 12:46:53 +0000 (13:46 +0100)]
fix: fixed the return-type of the `listen`-endpoint

16 months agofeat: Implemented an endpoint to get the details of a chatroom
Kai Moritz [Sun, 25 Dec 2022 22:02:47 +0000 (23:02 +0100)]
feat: Implemented an endpoint to get the details of a chatroom