import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.kafka.test.context.EmbeddedKafka;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
import java.time.Clock;
+import java.time.Duration;
import java.util.List;
+import java.util.UUID;
import static de.juplo.kafka.chat.backend.domain.ChatHomeServiceWithShardsTest.NUM_SHARDS;
import static de.juplo.kafka.chat.backend.implementation.kafka.KafkaChatHomeServiceTest.DATA_TOPIC;
static class KafkaChatHomeTestConfiguration
{
@Bean
- KafkaServicesApplicationRunner.WorkAssignor workAssignor(DataChannel dataChannel)
+ KafkaServicesApplicationRunner.WorkAssignor workAssignor(
+ InfoChannel infoChannel,
+ DataChannel dataChannel)
{
return consumer ->
{
+ // TODO: Darauf warten, dass der Chat-Room erzeugt wurde!
+ Awaitility
+ .await()
+ .atMost(Duration.ofSeconds(10))
+ .until(() -> infoChannel
+ .getChatRoomInfo(UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7"))
+ .block() != null);
List<TopicPartition> assignedPartitions =
List.of(new TopicPartition(DATA_TOPIC, 2));
consumer.assign(assignedPartitions);