demos/kafka/chat
2 months agoWIP:fix:activation backend-handover-it
Kai Moritz [Fri, 15 Mar 2024 15:22:14 +0000 (16:22 +0100)]
WIP:fix:activation

2 months agoWIP:fix:activation
Kai Moritz [Fri, 15 Mar 2024 15:10:14 +0000 (16:10 +0100)]
WIP:fix:activation

2 months agoWIP:TMP:test -- FIX: `ChatRoomData` active/inactive
Kai Moritz [Fri, 15 Mar 2024 15:08:38 +0000 (16:08 +0100)]
WIP:TMP:test -- FIX: `ChatRoomData` active/inactive

2 months agoTMP:test:FIX
Kai Moritz [Tue, 12 Mar 2024 08:54:00 +0000 (09:54 +0100)]
TMP:test:FIX

2 months agoTMP:test -- FIX: `ChatRoomData` active/inactive
Kai Moritz [Mon, 11 Mar 2024 14:57:06 +0000 (15:57 +0100)]
TMP:test -- FIX: `ChatRoomData` active/inactive

2 months agoWAS:TMP:IS?FIX:WIP:test: `*ConfigurationIT` asserts, if restored messages can be...
Kai Moritz [Mon, 11 Mar 2024 12:08:21 +0000 (13:08 +0100)]
WAS:TMP:IS?FIX:WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen

2 months agoWIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
Kai Moritz [Sat, 16 Mar 2024 09:39:12 +0000 (10:39 +0100)]
WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen

2 months agoTMP:disable-handoverit
Kai Moritz [Sat, 16 Mar 2024 09:36:48 +0000 (10:36 +0100)]
TMP:disable-handoverit

2 months agoWIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
Kai Moritz [Thu, 14 Mar 2024 18:11:36 +0000 (19:11 +0100)]
WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen

2 months agoWIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
Kai Moritz [Thu, 14 Mar 2024 11:05:11 +0000 (12:05 +0100)]
WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen

2 months agoWIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
Kai Moritz [Thu, 14 Mar 2024 09:52:28 +0000 (10:52 +0100)]
WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen

2 months agoTMP:test -- `ChatRoomDataTest`
Kai Moritz [Mon, 11 Mar 2024 14:45:15 +0000 (15:45 +0100)]
TMP:test -- `ChatRoomDataTest`
--
TODO: Anpassungen an Codeänderungen durch FIX

2 months agoWIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
Kai Moritz [Mon, 11 Mar 2024 10:59:50 +0000 (11:59 +0100)]
WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen
--
TODO: Ist der Test so vollständig, bzw. auf dem letzten Stand?

2 months agoWIP:reconnect
Kai Moritz [Mon, 11 Mar 2024 17:32:46 +0000 (18:32 +0100)]
WIP:reconnect

2 months agotest: HandoverIT - RED - Started a second backend
Kai Moritz [Fri, 8 Mar 2024 08:14:14 +0000 (09:14 +0100)]
test: HandoverIT - RED - Started a second backend

* A second backend is started, after the writers and the listener were
  instanciated.
* The test fails, because the listener does not see messages, that are
  send by the writers after the rebalance finishes.

2 months agofix: GREEN - `ChatRoomData` obeys to the added expectations.
Kai Moritz [Sat, 9 Mar 2024 10:17:33 +0000 (11:17 +0100)]
fix: GREEN - `ChatRoomData` obeys to the added expectations.

* Switched `ChatRoomData` from a multicast- to a replay-sink.
* Before, listening was implemented with a multicast-sink, that enabled
  back-pressure.
* Now, it was refactored to use a replay-sink, that enables a (configurable)
  limitted replay.

2 months agotest: RED - Added test for multiple parallel Listeners to `ChatRoomDataTest`
Kai Moritz [Fri, 8 Mar 2024 17:10:43 +0000 (18:10 +0100)]
test: RED - Added test for multiple parallel Listeners to `ChatRoomDataTest`

* The test formulates the expectation, that late listeners should see all
  messages (for a reasonable long period before their subscriptions)
* The test _fails_, because the implementation only buffers messages for
  backpressure -- _not for replay!_

2 months agochore: The GitHub-Action for the Maven-Build is triggerd for all branches
Kai Moritz [Fri, 15 Mar 2024 21:28:53 +0000 (22:28 +0100)]
chore: The GitHub-Action for the Maven-Build is triggerd for all branches

2 months agotest: Fixed `AbstractConfigurationIT#testPutMessageInNewChatRoom()`
Kai Moritz [Fri, 15 Mar 2024 15:04:38 +0000 (16:04 +0100)]
test: Fixed `AbstractConfigurationIT#testPutMessageInNewChatRoom()`

* In the case, that the request that adds a messag failed, the longly
  process of creating a new chat-room, until it has the correct shard,
  was unnecessarily repeated.
* Different workarounds have to be applied at the same time for the two
  implementations:
** Because `ShardedChatHomeService` only throws a `ShardNotOwnedException`,
   if the shard, that is picked by the strategy is not owned, the result
   is retried until the requests succeeds by chance.
** The `KafkaChatHomeService` always creates the chat-room in the
   partition, that is derived from the randomly picked id.
   Hence, the loop, that is only left, if the randomly picked partition
   matches the partition `2`, that the test-instance owns.
** Since `SimpleChatHomeService` does not know the concept of sharding
   at all, the loop is also left, if no shard is set (shard is ``null``).

2 months agotest: Refined `AbstractConfigurationIT#testPutMessageInNewChatRoom()`
Kai Moritz [Fri, 15 Mar 2024 10:58:59 +0000 (11:58 +0100)]
test: Refined `AbstractConfigurationIT#testPutMessageInNewChatRoom()`

* Removed unnecessary asserts: the expected result of the creation of a
  chat-room is no concern of this test.
* Simplified the assertion of the shard.

2 months agotest: Fixed `AbstractConfigurationIT#testPutMessageInNewChatRoom()`
Kai Moritz [Fri, 15 Mar 2024 10:18:29 +0000 (11:18 +0100)]
test: Fixed `AbstractConfigurationIT#testPutMessageInNewChatRoom()`

* The first request in the awaited assertion must create a chat-room,
  that is owned by the instance.
* Hence, _it has to_ assert, that the shard of the created chat-room is
  `2` - the only shard, the test-instance owns, or _empty_, if the instance
  under test does not implement sharding.

2 months agotest: Added tests for listening to `ChatRoomDataTest`
Kai Moritz [Fri, 8 Mar 2024 09:48:20 +0000 (10:48 +0100)]
test: Added tests for listening to `ChatRoomDataTest`

2 months agotest: Refactored `ChatRoomDataTest` - made mocking more clear
Kai Moritz [Fri, 8 Mar 2024 11:27:15 +0000 (12:27 +0100)]
test: Refactored `ChatRoomDataTest` - made mocking more clear

* When mocking the results of calls to `ChatMessageService`, the returned
  message does naturally _not_ reflect the parameters of the call.
* Hence, a arbitrary message is used whenever the test only asserts,
  that a value, that was returened by `ChatMessageService` is handed
  through as expected by `ChatRoomData`.

2 months agotest: Removed unnecessary Mockito-recordings in `ChatRoomDataTest`
Kai Moritz [Fri, 8 Mar 2024 11:24:52 +0000 (12:24 +0100)]
test: Removed unnecessary Mockito-recordings in `ChatRoomDataTest`

2 months agotest: `ChatRoomDataTest` verifies that persistence is triggered as expected
Kai Moritz [Fri, 8 Mar 2024 10:55:25 +0000 (11:55 +0100)]
test: `ChatRoomDataTest` verifies that persistence is triggered as expected

2 months agotest: Refactored `ChatRoomDataTest` - DRY for message attributes
Kai Moritz [Fri, 8 Mar 2024 10:01:23 +0000 (11:01 +0100)]
test: Refactored `ChatRoomDataTest` - DRY for message attributes

2 months agochore: activated IT in GitHUB-Maven-Build
Kai Moritz [Fri, 15 Mar 2024 20:17:48 +0000 (21:17 +0100)]
chore: activated IT in GitHUB-Maven-Build

2 months agochore: Create maven.yml
Kai Moritz [Fri, 15 Mar 2024 20:10:14 +0000 (21:10 +0100)]
chore: Create maven.yml

2 months agotest: HandoverIT-POC - Refactored `TestListener`
Kai Moritz [Mon, 11 Mar 2024 17:15:32 +0000 (18:15 +0100)]
test: HandoverIT-POC - Refactored `TestListener`

2 months agotest: HandoverIT-POC - Added logging for complete/error to listener
Kai Moritz [Mon, 11 Mar 2024 17:14:17 +0000 (18:14 +0100)]
test: HandoverIT-POC - Added logging for complete/error to listener

2 months agotest: HandoverIT-POC - Waiting for the assertion when all messages are sent
Kai Moritz [Thu, 7 Mar 2024 17:52:42 +0000 (18:52 +0100)]
test: HandoverIT-POC - Waiting for the assertion when all messages are sent

2 months agotest: HandoverIT-POC - Refactored the startup of backend-containers
Kai Moritz [Thu, 7 Mar 2024 16:43:30 +0000 (17:43 +0100)]
test: HandoverIT-POC - Refactored the startup of backend-containers

* The backend-containers are explicitly started during the test.
* When a backend is started, it is waited for, that the started backend
  reportes its status as `UP`, _and_, that alle writers are again able to
  send messages, afterwards.

2 months agorefactor: Simplified the configuration for the kafka-services
Kai Moritz [Wed, 6 Mar 2024 14:34:20 +0000 (15:34 +0100)]
refactor: Simplified the configuration for the kafka-services

* Removed class `ChannelTaskRunner` and `KafkaServicesApplicationRunner`.
* Instead, the method `ChannelTaskExecutor.excuteChannelTask()` is executed
  as `@Bean.initMethod` by Spring.
* Adapted the test-cases accordingly:
** Joinig the channel-tasks is not necessary any more, because that is
   done by the imported production-config
** `KafkaConfigurationIT` has to call `executeChannelTasks()`
   explicitly
** Therefore, it has to overrule the default-config for the bean
   `dataChannelTaskExecutor` in order to drop the configuration of the
   `initMethod`.
** Otherwise, the test would (might) not restore the data from the topic,
   because the messages, that are send into the test-cluster, might arrive
   only after the initial loading of the data is done.

2 months agorefactor: Removed config-dependencies from `ChannelTaskExecutor`
Kai Moritz [Wed, 6 Mar 2024 09:23:53 +0000 (10:23 +0100)]
refactor: Removed config-dependencies from `ChannelTaskExecutor`

2 months agorefactor: Simplified shutdown - channel-tasks were joined multiple times
Kai Moritz [Wed, 6 Mar 2024 09:07:53 +0000 (10:07 +0100)]
refactor: Simplified shutdown - channel-tasks were joined multiple times

* `KafkaServicesApplicationRunner` does not have to join the channel-tasks.
* The channel-tasks are already joined by `ChannelTaskExecutor.join()`
  automatically, because the method is annotated with `@PreDestroy`.
* Simplified the test-configuration accordingly.

2 months agofix: The shutdown of the application was blocked
Kai Moritz [Wed, 6 Mar 2024 07:26:03 +0000 (08:26 +0100)]
fix: The shutdown of the application was blocked

* The auto-configured bean `applicationTaskExecutor` must not block, while
  it is shutting down, because otherwise, it infinitly waits for the
  completion, of the channel-tasks, which are stopped in a _later_ phase
  of the "smart" lifecycle.
* The bean is destroyed first, becaus it is is associated with the lowest
  lifecyle-phase (``Integer.MAX_VALUE``), which apparently cannot be
  overruled by `@DependsOn` (although suggested by the spring-
  documentation)
* Joining the channel-tasks was blocking infinitly, because the tasks were
  waiting for the kafka-consumers to be closed, what only happens _after_
  the joining completes.

2 months agofix: Detection of the `READY`-state for `InfoChannel` was flawed
Kai Moritz [Tue, 5 Mar 2024 16:50:47 +0000 (17:50 +0100)]
fix: Detection of the `READY`-state for `InfoChannel` was flawed

2 months agofeat: Implemented and configured health-indicator for the ``Channel``s
Kai Moritz [Tue, 5 Mar 2024 08:46:55 +0000 (09:46 +0100)]
feat: Implemented and configured health-indicator for the ``Channel``s

2 months agorefactor: Refined channel-states, introduced `ChannelState` -- ALIGN
Kai Moritz [Mon, 4 Mar 2024 13:34:34 +0000 (14:34 +0100)]
refactor: Refined channel-states, introduced `ChannelState` -- ALIGN

* Renamed attributes and method-names according to the class-renames.
* Introduced interface `Channel` and `enum ChannelState`.
* `Data` - and `InfoChannel` maintain a `ChannelState`, instead just a
  plain boolean, that only reflects the loading-state.
* The `ChannelTaskRunner` waits, until both channels entered the State
  `ChannelState.SHUTTING_DOWN`.

2 months agorefactor: Refined channel-states, introduced `ChannelState` -- MOVE
Kai Moritz [Mon, 4 Mar 2024 13:32:14 +0000 (14:32 +0100)]
refactor: Refined channel-states, introduced `ChannelState` -- MOVE

* Renamed and moved `LoadInProgressException`
** Moved exception into implementation-specific package
** Renamed exception to `ChannelNotReadyException`
* Renamed `ConsumerTaskExecutor` into `ChannelTaskExecutor`
* Renamed `ConsumerTaskRunner` into `ChannelTaskRunner`

2 months agotest: HandoverIT-POC - Added assertions for the sent/received messages
Kai Moritz [Mon, 4 Mar 2024 08:29:19 +0000 (09:29 +0100)]
test: HandoverIT-POC - Added assertions for the sent/received messages

2 months agotest: HandoverIT-POC - fix for the blocking wait for `TestListener`
Kai Moritz [Sun, 3 Mar 2024 09:20:11 +0000 (10:20 +0100)]
test: HandoverIT-POC - fix for the blocking wait for `TestListener`

* Droped the waiting for `TestListener` alltogehter.
* The waiting can be droped, because waiting for the `TestWriter`-instances
  ensures, that all messages are send (and therefore very likely received)

2 months agotest: HandoverIT-POC - working fix: using `delayElements()`
Kai Moritz [Sun, 3 Mar 2024 09:08:36 +0000 (10:08 +0100)]
test: HandoverIT-POC - working fix: using `delayElements()`

* Switched from `Flux.flatMap(Mono.delay()..)` to
  `Flux.from(..).delayElements()`FIX:delay_vs_delayElements.
* This delays eache element of the `Flux` by the same amount.
* The requests are made, when the according element of the flux is
  executed - not when the `Flux` is created, as before.

2 months agotest: HandoverIT-POC - not working fix: using `delay()`
Kai Moritz [Sat, 2 Mar 2024 17:21:44 +0000 (18:21 +0100)]
test: HandoverIT-POC - not working fix: using `delay()`

* Switched from `Mono.from(..).delayElement()` to `Mono.delay().then()`.
* This does _not_ solve the problem, that all delays are calculated and
  scheduled, when the `Flux` is created.

2 months agotest: HandoverIT-POC - FIX: `take(n)`, does end the work after n elements
Kai Moritz [Sat, 2 Mar 2024 17:21:05 +0000 (18:21 +0100)]
test: HandoverIT-POC - FIX: `take(n)`, does end the work after n elements

* `take(n)` does end the execution.
* `limitRate(n)` limits the rate of requested elements.

2 months agotest: HandoverIT-POC - Executing the Flux/Mono asynchrounusly
Kai Moritz [Fri, 1 Mar 2024 19:40:18 +0000 (20:40 +0100)]
test: HandoverIT-POC - Executing the Flux/Mono asynchrounusly

2 months agotest: HandoverIT-POC - Listener/Writer remember received/sent messages
Kai Moritz [Fri, 1 Mar 2024 19:18:00 +0000 (20:18 +0100)]
test: HandoverIT-POC - Listener/Writer remember received/sent messages

2 months agotest: HandoverIT-POC - Refactored listening into class `TestListener`
Kai Moritz [Fri, 1 Mar 2024 14:08:06 +0000 (15:08 +0100)]
test: HandoverIT-POC - Refactored listening into class `TestListener`

2 months agotest: HandoverIT-POC - Refactored `TestWriter` to use a `Flux`
Kai Moritz [Fri, 1 Mar 2024 13:53:43 +0000 (14:53 +0100)]
test: HandoverIT-POC - Refactored `TestWriter` to use a `Flux`

2 months agotest: HandoverIT-POC - Each `TestWriter` writes only to one chat-room
Kai Moritz [Fri, 1 Mar 2024 13:05:11 +0000 (14:05 +0100)]
test: HandoverIT-POC - Each `TestWriter` writes only to one chat-room

2 months agotest: HandoverIT-POC - Refactored / Cleaned up
Kai Moritz [Fri, 1 Mar 2024 13:02:01 +0000 (14:02 +0100)]
test: HandoverIT-POC - Refactored / Cleaned up

2 months agotest: HandoverIT-POC - Renamed `TestClient` to `TestWriter` -- ALIGN
Kai Moritz [Fri, 1 Mar 2024 12:48:57 +0000 (13:48 +0100)]
test: HandoverIT-POC - Renamed `TestClient` to `TestWriter` -- ALIGN

2 months agotest: HandoverIT-POC - Renamed `TestClient` to `TestWriter` -- MOVE
Kai Moritz [Fri, 1 Mar 2024 12:46:54 +0000 (13:46 +0100)]
test: HandoverIT-POC - Renamed `TestClient` to `TestWriter` -- MOVE

2 months agotest: HandoverIT-POC - Fixed illegal client-naming (one character only)
Kai Moritz [Wed, 28 Feb 2024 21:43:28 +0000 (22:43 +0100)]
test: HandoverIT-POC - Fixed illegal client-naming (one character only)

2 months agotest: HandoverIT-POC - Fixed logging of failed client-requests
Kai Moritz [Wed, 28 Feb 2024 21:39:59 +0000 (22:39 +0100)]
test: HandoverIT-POC - Fixed logging of failed client-requests

2 months agofix: Fixed `ConcurrentModificationException` when accessing a chat-room
Kai Moritz [Wed, 28 Feb 2024 10:50:11 +0000 (11:50 +0100)]
fix: Fixed `ConcurrentModificationException` when accessing a chat-room

* If a new chat-room was created, `InfoChannel` only reacted with the
  creation of the according `ChatRoomInfo`-instance.
* The creation of the accompanying `ChatRoomData`-instance through
  `DataChannel` was posponed until the new chat-room was accessed the
  first time.
* That way, `InfoChannel` did not need to know `DataChannel`, so that a
  cyclic dependency could be avoided.
* As a downside, this approach was open to a race-condition: if several
  accesses to the newly created chat-room happend in parallel, a
  `ConcurrentModificationException` was thrown, since the instance of
  `ChatRoomData` was created multiple times in parallel.
* To circumvent the locking, that would be necesarry to evade this race
  condition, the approach was refactored, so that `InfoChannel` now
  explicitly triggers the creation of the `ChatRoomData`-instance.
* To do so without introducing a cyclic dependency, the class
  `ChannelMediator` was introduced, so that `InfoChannel` and `DataChannel`
  need not to know each other.

2 months agorefactor: Introduced `ChannelMediator`
Kai Moritz [Wed, 28 Feb 2024 10:14:32 +0000 (11:14 +0100)]
refactor: Introduced `ChannelMediator`

* `InfoChannel` and `DataChannel` must not know each other directly.
* This is necessary, to prevent a cyclic dependency, that would otherwise
  be introduced, if `InfoChannel` also has to communicate with
  `DataChannel`.

2 months agotest: HandoverIT-POC - clients are stopped after some time
Kai Moritz [Wed, 28 Feb 2024 09:09:56 +0000 (10:09 +0100)]
test: HandoverIT-POC - clients are stopped after some time

2 months agotest: HandoverIT-POC - running multiple clients in parallel
Kai Moritz [Wed, 28 Feb 2024 08:59:20 +0000 (09:59 +0100)]
test: HandoverIT-POC - running multiple clients in parallel

2 months agotest: HandoverIT-POC - added a delay to the sending-loop
Kai Moritz [Tue, 27 Feb 2024 22:53:08 +0000 (23:53 +0100)]
test: HandoverIT-POC - added a delay to the sending-loop

2 months agotest: HandoverIT-POC - remodeled sending into a for-loop
Kai Moritz [Tue, 27 Feb 2024 22:42:27 +0000 (23:42 +0100)]
test: HandoverIT-POC - remodeled sending into a for-loop

2 months agotest: HandoverIT-POC - messages are written to 23 chat-rooms instead of 1
Kai Moritz [Tue, 27 Feb 2024 20:56:45 +0000 (21:56 +0100)]
test: HandoverIT-POC - messages are written to 23 chat-rooms instead of 1

2 months agotest: HandoverIT-POC - splitted up code into smaller classes -- ALIGN
Kai Moritz [Tue, 27 Feb 2024 08:39:56 +0000 (09:39 +0100)]
test: HandoverIT-POC - splitted up code into smaller classes -- ALIGN

2 months agotest: HandoverIT-POC - splitted up code into smaller classes -- MOVE
Kai Moritz [Tue, 27 Feb 2024 08:31:51 +0000 (09:31 +0100)]
test: HandoverIT-POC - splitted up code into smaller classes -- MOVE

2 months agotest: HandoverIT-POC - Moved general container-defs into base-class
Kai Moritz [Tue, 27 Feb 2024 08:24:41 +0000 (09:24 +0100)]
test: HandoverIT-POC - Moved general container-defs into base-class

2 months agotest: HandoverIT-POC - setup without static containers
Kai Moritz [Tue, 27 Feb 2024 04:14:09 +0000 (05:14 +0100)]
test: HandoverIT-POC - setup without static containers

2 months agotest: HandoverIT-POC - first working setup for the planned test
Kai Moritz [Sat, 3 Feb 2024 07:29:06 +0000 (08:29 +0100)]
test: HandoverIT-POC - first working setup for the planned test

* First working POC of the setup for the planned test.
* This version blocks endlessly, because the SSE-flux never completes.

2 months agofix: Errors during shard-publishing should not kill the instance
Kai Moritz [Mon, 26 Feb 2024 18:55:19 +0000 (19:55 +0100)]
fix: Errors during shard-publishing should not kill the instance

* `HaproxyShardingPublisherStrategy` has to transform any exception into
  a `Mono.error()`.
* `DataChannel.onPartitionsAssigned(..)` has to log and swallow errors
  during the propagation of the shard-ownership.

2 months agofix: Sensible value for sink-buffer
Kai Moritz [Sun, 25 Feb 2024 20:44:16 +0000 (21:44 +0100)]
fix: Sensible value for sink-buffer

2 months agofeat: Made polling-interval for Kafka configurable
Kai Moritz [Sun, 25 Feb 2024 19:50:21 +0000 (20:50 +0100)]
feat: Made polling-interval for Kafka configurable

2 months agofix: The number of chards is the number of partitions of the `data_channel`
Kai Moritz [Sat, 24 Feb 2024 11:56:24 +0000 (12:56 +0100)]
fix: The number of chards is the number of partitions of the `data_channel`

2 months agofix: Disabled mongodb-autoconfig, if mongodb is not used
Kai Moritz [Fri, 23 Feb 2024 10:39:26 +0000 (11:39 +0100)]
fix: Disabled mongodb-autoconfig, if mongodb is not used

2 months agofeat: Switched to `spring-boot-starter-data-mongodb-reactive`
Kai Moritz [Sat, 3 Feb 2024 23:24:07 +0000 (00:24 +0100)]
feat: Switched to `spring-boot-starter-data-mongodb-reactive`

2 months agofeat: Added logging for io.projectreactor to `MongoDbStorageStrategy`
Kai Moritz [Tue, 20 Feb 2024 16:35:14 +0000 (17:35 +0100)]
feat: Added logging for io.projectreactor to `MongoDbStorageStrategy`

2 months agorefactor: DRY for logging-category from io.projectreactor
Kai Moritz [Tue, 20 Feb 2024 16:32:54 +0000 (17:32 +0100)]
refactor: DRY for logging-category from io.projectreactor

2 months agofeat: Added counting of restored instances
Kai Moritz [Tue, 20 Feb 2024 15:14:22 +0000 (16:14 +0100)]
feat: Added counting of restored instances

2 months agotest: `StorageStrategy`-IT are restoring instead of recreating
Kai Moritz [Thu, 22 Feb 2024 15:46:27 +0000 (16:46 +0100)]
test: `StorageStrategy`-IT are restoring instead of recreating

2 months agofix: GREEN - Fixed the restore-mechanism
Kai Moritz [Thu, 22 Feb 2024 15:03:08 +0000 (16:03 +0100)]
fix: GREEN - Fixed the restore-mechanism

* The code of a reactive flow _must not_ call blocking functions.
* In order to solve this, the restore-process is triggered explicitly
  after the creation of the classes.

2 months agorefactor: RED - Refined success/error-handling for restore-operations
Kai Moritz [Tue, 20 Feb 2024 15:12:00 +0000 (16:12 +0100)]
refactor: RED - Refined success/error-handling for restore-operations

* This innocent little change discloses a severe missconception in the
  implementation of the storage strategies.
* The call to `Mono.block()`, though not really changing the behaviour
  during the restore-process, triggers a sanity-check from
  io.projectractor.

2 months agotest: Simplified the integration-tests for `StorageStrategy`
Kai Moritz [Thu, 22 Feb 2024 14:35:39 +0000 (15:35 +0100)]
test: Simplified the integration-tests for `StorageStrategy`

2 months agotest: Simplified `InMemoryWithMongoDbStorageIT`
Kai Moritz [Thu, 22 Feb 2024 13:49:46 +0000 (14:49 +0100)]
test: Simplified `InMemoryWithMongoDbStorageIT`

* Switched to `@ServiceConnection` instead of hand-coded initializer.

2 months agotest: Added IT for `ChatRoomRepository` and `MessageRepository`
Kai Moritz [Wed, 21 Feb 2024 17:30:01 +0000 (18:30 +0100)]
test: Added IT for `ChatRoomRepository` and `MessageRepository`

2 months agotest: Simplified & Unified the Kafka-tests
Kai Moritz [Thu, 22 Feb 2024 13:39:30 +0000 (14:39 +0100)]
test: Simplified & Unified the Kafka-tests

2 months agotest: Simplified `ChatHomeServiceTest`
Kai Moritz [Thu, 22 Feb 2024 13:24:28 +0000 (14:24 +0100)]
test: Simplified `ChatHomeServiceTest`

* Removed the unnecessary explicit instantiation of the `ObjectMapper`.

2 months agotest: Simplified & unified test-setup for ``ChatHomeServiceTest``s
Kai Moritz [Thu, 22 Feb 2024 12:10:09 +0000 (13:10 +0100)]
test: Simplified & unified test-setup for ``ChatHomeServiceTest``s

* Using existing configuration-classes instead of hand-coded configuartion.
* Aligned the `KafkaChatHomeServiceTest` with the `in-memory`-tests.

2 months agorefactor: Cleaned up code
Kai Moritz [Tue, 20 Feb 2024 12:05:21 +0000 (13:05 +0100)]
refactor: Cleaned up code

2 months agofeat: Introduced counting of stored instances in `StorageStrategy`
Kai Moritz [Tue, 20 Feb 2024 12:02:09 +0000 (13:02 +0100)]
feat: Introduced counting of stored instances in `StorageStrategy`

2 months agofeat: Introduced config-parameters for the `io.projectreactor`-logging
Kai Moritz [Tue, 20 Feb 2024 11:48:40 +0000 (12:48 +0100)]
feat: Introduced config-parameters for the `io.projectreactor`-logging

2 months agorefactor: Set logging-level for io.projectreactor to `DEBUG`
Kai Moritz [Tue, 20 Feb 2024 10:43:00 +0000 (11:43 +0100)]
refactor: Set logging-level for io.projectreactor to `DEBUG`

2 months agorefactor: Refined stream-definition in `StorageStrategy#write`
Kai Moritz [Tue, 20 Feb 2024 10:28:22 +0000 (11:28 +0100)]
refactor: Refined stream-definition in `StorageStrategy#write`

* Changed the stream-definition to a more natural order.
* As a result, the stored `ChatRoomInfo`-instances do not have to be
  handed clumsily to the following stream.

2 months agorefactor: Refined return-type of `StorageStrategy#write`
Kai Moritz [Tue, 20 Feb 2024 10:14:43 +0000 (11:14 +0100)]
refactor: Refined return-type of `StorageStrategy#write`

2 months agorefactor: One stream -> using `flatMap` instead of an inner `subscribe`
Kai Moritz [Tue, 20 Feb 2024 07:50:56 +0000 (08:50 +0100)]
refactor: One stream -> using `flatMap` instead of an inner `subscribe`

2 months agorefactor: Moved succes/error-logging to outer stream-definitions
Kai Moritz [Tue, 20 Feb 2024 07:23:13 +0000 (08:23 +0100)]
refactor: Moved succes/error-logging to outer stream-definitions

2 months agorefactor: Simplified `StorageStrategy`
Kai Moritz [Tue, 20 Feb 2024 06:47:22 +0000 (07:47 +0100)]
refactor: Simplified `StorageStrategy`

* Reconfigurable success/error-logging was introduced for
  `NoStorageStorageStrategy`.
* But as it turns out, this strategy can simply apply its logging in the
  overwritten method, that disables the whole storing-logic.
* Hence, the interface was greatly simplified again, by removing this
  ununsed mechanism.

2 months agorefactor: Moved extracted the `subscribe()`-call from `StorageStrategy`
Kai Moritz [Mon, 19 Feb 2024 14:01:58 +0000 (15:01 +0100)]
refactor: Moved extracted the `subscribe()`-call from `StorageStrategy`

* The subscription does no more happen inside the implementations of the
  interface `StorageStrategy`.
* Instead, the methods, that are defined in `StorageStrategy` return the
  created `Flux`.
* The call to `subscribe()` happens in the code, that uses this methods.
* This faciliates feature refinements concerning the asynchronous handling
  of success- and error-cases and so forth.

2 months agorefactor: Extracted subscription into a separate method-call
Kai Moritz [Sat, 3 Feb 2024 23:37:23 +0000 (00:37 +0100)]
refactor: Extracted subscription into a separate method-call

* This is in preparation to a planed refinement.
* The refinment will move the `subscribe()`-call out of the implementation
  of the `StorageStrategy`.

2 months agotest: Added missing JSR-310 module to not Spring-Boot-based tests
Kai Moritz [Mon, 19 Feb 2024 13:50:34 +0000 (14:50 +0100)]
test: Added missing JSR-310 module to not Spring-Boot-based tests

2 months agofeat: Added log message for disabled storage
Kai Moritz [Mon, 19 Feb 2024 13:31:21 +0000 (14:31 +0100)]
feat: Added log message for disabled storage

2 months agofix: Without `@DirtiesContext` the app is not teared down correctly
Kai Moritz [Sun, 18 Feb 2024 19:12:19 +0000 (20:12 +0100)]
fix: Without `@DirtiesContext` the app is not teared down correctly

* `StorageStrategy` depends on Spring to call the method
  `ChatBackendApplication#onExit()`, that is annotated with `@PreDestroy`.
* If this method is not called, the strategy is not applied, which leads
  to errors in the integration-tests.
* This happens, if all tests are run through Maven, because Spring
  recycles the application-context and only tears down the context after
  all tests have run.
* The addition of `@DirtiesContext` on those tests forces Spring to tear
  down the application completely after each so annotated test.
* Hence, the method is called as expected, which fixes the described
  errors.

2 months agotest: Introduced integration-tests for `NoStorageStorageStrategy`
Kai Moritz [Mon, 19 Feb 2024 10:05:17 +0000 (11:05 +0100)]
test: Introduced integration-tests for `NoStorageStorageStrategy`
--
ALIGN