I have a problem while testing the integration of a Kafka consumer with kafkaContainer.In practice, when I send the message with the template, the consumer is not invoked.Can you help me?
Here is some code:
Consumer:
@Component@Slf4jpublic class BCDConsumer { private ObjectMapper objectMapper; private BCDProducerService bluetoothCountingDataProducer; private TenantMapper tenantMapper; private ConsumerWithErrorManagement consumerWithErrorManagement; private Timer timer = Metrics.timer("maas.kafka.consumer", "type", "BluetoothCountingDataBulk"); @Autowired public BCDConsumer( ObjectMapper objectMapper, BCDProducerService bluetoothCountingDataProducer, TenantMapper tenantMapper, ConsumerWithErrorManagement consumerWithErrorManagement) { this.objectMapper = objectMapper; this.bluetoothCountingDataProducer = bluetoothCountingDataProducer; this.tenantMapper = tenantMapper; this.consumerWithErrorManagement = consumerWithErrorManagement; } @KafkaListener( topics = "${kafka.bluetooth.counting.data.bulk.topic}", containerFactory = "dataKafkaListenerContainerFactory") public void consumerBCDTopic( String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { timer.record(() -> performWithErrorManagement(topic, message)); } private void performWithErrorManagement(String topic, String message) { consumerWithErrorManagement.consumeMessage(topic, message, "", () -> perform(message)); } private void perform(String message) throws ValidationException { log.debug("consumerBCDTopic - consumer messages on 'BluetoothCountingData' topic"); List<BluetoothCountingDataDTO> bluetoothCountingDataList; try { bluetoothCountingDataList = objectMapper.readValue(message, new TypeReference<>() {}); } catch (JsonProcessingException e) { log.error("Fatal Error during conversion of JSON String to TypeReference. No managed"+" clean state", e); throw new BusinessException(e); } for (BluetoothCountingDataDTO bluetoothCountingData : bluetoothCountingDataList) { for (DeviceDTO device : bluetoothCountingData.getDeviceDTOS()) { BusinessObjectWrapper<BluetoothCountingData> wrapper = BCDBusinessFactory.createBCDBusiness( bluetoothCountingData, device, tenantMapper.getTenantId(bluetoothCountingData.getOperator())); this.bluetoothCountingDataProducer.publishOnKafkaOfficialTopic(wrapper); } } }}
Service (BCDProducerService):
@Service@RequiredArgsConstructor@Slf4jpublic class BCDProducerService implements ProducerService< BluetoothCountingDataDTO, BusinessObjectWrapper<BluetoothCountingData>> { private final Timer bulkTimer = Metrics.timer("maas.kafka.producer", "topic", "bluetooth.counting.data.bulk.topic"); private final Timer timer = Metrics.timer("maas.kafka.producer", "topic", "bluetooth.counting.data.topic"); @Value("${kafka.bluetooth.counting.data.bulk.topic}") private final String internalTopicName; @Value("${kafka.bluetooth.counting.data.topic}") private final String topicName; private final KafkaProducer kafkaProducer; @Override public CompletableFuture<SendResult<String, String>> publishListOnKafkaBulkTopic( List<BluetoothCountingDataDTO> payload) { log.debug("publish list of {} elements into 'BluetoothCountingData' bulk topic", payload.size()); bulkTimer.record( () -> { try { return this.kafkaProducer.publish(internalTopicName, payload); } catch (JsonProcessingException e) { throw new ProducerServiceException(e); } }); return null; } @Override public void publishOnKafkaOfficialTopic(BusinessObjectWrapper<BluetoothCountingData> payload) { log.debug("publish an element on 'BluetoothCountingData' topic - element: {}", payload); timer.record( () -> { try { this.kafkaProducer.publish(topicName, payload); } catch (JsonProcessingException e) { throw new ProducerServiceException(e); } }); }}
This is my integration test that doesn't work:
@Testcontainers@SpringBootTest(classes = BCDConsumer.class)@Import(ExampleIntegrationTest.KafkaTestContainersConfiguration.class)class ExampleIntegrationTest { @Container private static final KafkaContainer kafkaContainer = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka")) .withEnv("KAFKA_AUTO_CREATE_TOPICS_ENABLE", "true"); @Autowired private KafkaTemplate<String, String> kafkaTemplate; @MockBean private ObjectMapper objectMapper; @MockBean private TenantMapper tenantMapper; @MockBean private BCDProducerService producer; //@MockBean private KafkaProducer kafkaProducer; @MockBean private ConsumerWithErrorManagement consumerWithErrorManagement; @Autowired private BCDConsumer consumer; @Value("${kafka.bluetooth.counting.data.bulk.topic}") private String topic; //TEST @Value("${kafka.bluetooth.counting.data.bulk.topic}") private String internalTopicName; @Value("${kafka.bluetooth.counting.data.topic}") private String topicName; @Value("${kafka.bootstrap.address}") private String bootstrapAddress; @Value("${consumer.data.group.id}") private String groupId; @Value("${spring.kafka.listener.concurrency}") private int concurrency; @BeforeAll public static void setup() { kafkaContainer.start(); System.setProperty("kafka.bootstrap.address", kafkaContainer.getBootstrapServers()); } @AfterAll public static void stopContainers() { kafkaContainer.stop(); } @Test void shouldSendTheMessage() throws Exception { System.out.println("Topic:" + topic); System.out.println("Internal topic:" + internalTopicName); System.out.println("Topic name:" + topicName); System.out.println("Address:" + bootstrapAddress); System.out.println("GroupId:" + groupId); System.out.println("Concurrency:" + concurrency); final BluetoothCountingDataDTO bluetoothData = createBluetoothCountingDataDTO(); final String message = objectMapper.writeValueAsString(List.of(bluetoothData)); final CompletableFuture<SendResult<String, String>> future = kafkaTemplate.send(topic, message); System.out.println(future); future.get(); System.out.println(future); //kafkaTemplate.flush(); Thread.sleep(8000); verify(producer, times(1)).publishOnKafkaOfficialTopic(any()); } private BluetoothCountingDataDTO createBluetoothCountingDataDTO() { BluetoothCountingDataDTO dto = new BluetoothCountingDataDTO(); dto.setType(1); dto.setTripId("trip"); dto.setOperator("AMT"); dto.setSequenceNumber(14L); dto.setDiagnosticStatus(0); dto.setVehicleId("vehicle"); dto.setSourceSystemId("ss_id"); dto.setParentVehicleId("parent"); dto.setDeviceDTOS(createDeviceDtoList()); dto.setSysTimestamp(System.currentTimeMillis()); dto.setMessageId("addebf16-dcc3-40e8-bc11-a8ed2f01cc55"); return dto; } private List<DeviceDTO> createDeviceDtoList() { DeviceDTO device = new DeviceDTO(); device.setStatus(1); device.setLatitude(14d); device.setLongitude(47.23d); device.setStopId("stop_id"); device.setDeviceId("dev_id"); device.setBleTs(System.currentTimeMillis()); return Collections.singletonList(device); } @TestConfiguration static class KafkaTestContainersConfiguration { @Bean ConcurrentKafkaListenerContainerFactory<Integer, String> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<Integer, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); return factory; } @Bean public ConsumerFactory<Integer, String> consumerFactory() { return new DefaultKafkaConsumerFactory<>(consumerConfigs()); } @Bean public Map<String, Object> consumerConfigs() { Map<String, Object> props = new HashMap<>(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaContainer.getBootstrapServers()); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.GROUP_ID_CONFIG, "acIngestionData"); //props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "PLAINTEXT"); return props; } @Bean public ProducerFactory<String, String> producerFactory() { Map<String, Object> configProps = new HashMap<>(); configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaContainer.getBootstrapServers()); configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); return new DefaultKafkaProducerFactory<>(configProps); } @Bean public KafkaTemplate<String, String> kafkaTemplate() { KafkaTemplate<String, String> template = new KafkaTemplate<>(producerFactory()); template.setDefaultTopic("bluetoothCountingDataBulk"); return template; } @Bean public NewTopic topic() { System.out.println("Sto cercando di creare il topic"); return new NewTopic("bluetoothCountingDataBulk", 1, (short) 1); } /* @Bean @Primary public NewTopic newTopic() { System.out.println("Sto cercando di creare il topic"); return TopicBuilder.name(topic) .compact() .build(); } */ }}
This is the test/application.properties
######################################### SPRING WEB########################################server.servlet.contextPath=/ac-ingestionspring.application.name=ac-ingestionapplication.instance.id=${random.uuid}########################### ControllerAdvise##########################sdk.controller.advise.enable=true######################################### KAFKA########################################kafka.bootstrap.address=http://localhost:9092kafka.consumer.threadModel.core.pool.size=1kafka.consumer.threadModel.max.pool.size=0kafka.consumer.threadModel.keepAliveSeconds=1kafka.consumer.threadModel.threadNamePrefix=kafka-conskafka.stream.prefix=kafkakafka.concurrency.thread=2consumer.data.group.id=acIngestionDataspring.kafka.listener.concurrency=2######################################### KAFKA TOPICS########################################kafka.seat.counting.data.aggregate.topic=seatCountingDataAggregatekafka.seat.counting.data.aggregate.bulk.topic=seatCountingDataAggregateBulkkafka.people.counting.data.topic=peopleCountingDatakafka.carriage.counting.data.topic=carriageFlowOrCountkafka.carriage.weight.data.topic=carriageWeightkafka.carriage.position.data.topic=carriagePositionkafka.vehicle.flow.data.topic=vehicleFlowkafka.people.counting.data.bulk.topic=peopleCountingDataBulkkafka.carriage.counting.data.bulk.topic=carriageFlowOrCountBulkkafka.carriage.weight.data.bulk.topic=carriageWeightBulkkafka.carriage.position.data.bulk.topic=carriagePositionBulkkafka.bluetooth.counting.data.topic=bluetoothCountingDataTopickafka.bluetooth.counting.data.bulk.topic=bluetoothCountingDataBulkkafka.position.topic=positionTopickafka.position.bulk.topic=positionBulkkafka.station.congestion.topic=stationCongestionkafka.station.congestion.bulk.topic=stationCongestionBulkkafka.station.tracking.topic=stationTrackingkafka.station.tracking.bulk.topic=stationTrackingBulkkafka.station.queues.topic=stationQueuekafka.station.queues.bulk.topic=stationQueuesBulkkafka.inter.carriage.counting.data.bulk.topic=intercarriageFlowOrCountBulk######################################### MQTT TOPICS########################################mqtt.station.congestion.topic=operators/amt/entitytype/STATION/congestionmqtt.station.tracking.topic=operators/amt/entitytype/STATION/trackingmqtt.station.queues.topic=operators/amt/entitytype/STATION/queuesmqtt.vehicle.congestion.topic=operators/amt/entitytype/VEHICLE/congestionmqtt.vehicle.position.topic=operators/amt/entitytype/VEHICLE/positionmqtt.train.congestion.topic=operators/amt/entitytype/TRAIN/congestionmqtt.train.intercarriage.topic=operators/amt/entitytype/TRAIN/intercarriagemqtt.train.position.topic=operators/amt/entitytype/TRAIN/positionmqtt.bulk.topic=mqttBulkmqtt.broker.address=tcp://broker.emqx.io:1883##########################################MONITORING-CORE CLIENT#######################################http.monitoringcore.base.url=http://localhost:8081/monitoring-core######################################### ACTUATOR########################################management.endpoints.web.exposure.include=health,metrics,prometheus,infomanagement.endpoint.health.show-details=nevermanagement.endpoint.health.probes.enabled=truemanagement.health.livenessState.enabled=truemanagement.health.readinessState.enabled=true######################################### LOG LEVELS########################################logging.level.com.hitachirail.maas=INFOlogging.pattern.console=-%clr(%clr(${application.instance.id}) %d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}######################################### KAFKA LOG LEVEL########################################logging.level.org.apache.kafka=INFOlogging.level.org.springframework.kafka=INFO######################################### JACKSON########################################spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false################################# SDK library#################################consumer.with.error.management.enabled=true##############################input.validity.days=7################################# MQTT#################################mqtt.enabled = true####################### SECURITY-FRAMEWORK #######################security.framework.jwt.validation = falsesecurity.framework.jwt.header = Authorizationsecurity.framework.jwt.extra.header = X-USERINFO
Test output:
Topic:bluetoothCountingDataBulkInternal topic:bluetoothCountingDataBulkTopic name:bluetoothCountingDataTopicAddress:PLAINTEXT://localhost:63529GroupId:acIngestionDataConcurrency:211:04:50.042 trace_id= span_id= trace_flags= INFO ProducerConfig values: acks = -1 auto.include.jmx.reporter = true batch.size = 16384 bootstrap.servers = [PLAINTEXT://localhost:63529] buffer.memory = 33554432 client.dns.lookup = use_all_dns_ips client.id = producer-1 compression.type = none connections.max.idle.ms = 540000 delivery.timeout.ms = 120000 enable.idempotence = true interceptor.classes = [] key.serializer = class org.apache.kafka.common.serialization.StringSerializer linger.ms = 0 max.block.ms = 60000 max.in.flight.requests.per.connection = 5 max.request.size = 1048576 metadata.max.age.ms = 300000 metadata.max.idle.ms = 300000 metric.reporters = [] metrics.num.samples = 2 metrics.recording.level = INFO metrics.sample.window.ms = 30000 partitioner.adaptive.partitioning.enable = true partitioner.availability.timeout.ms = 0 partitioner.class = null partitioner.ignore.keys = false receive.buffer.bytes = 32768 reconnect.backoff.max.ms = 1000 reconnect.backoff.ms = 50 request.timeout.ms = 30000 retries = 2147483647 retry.backoff.ms = 100 sasl.client.callback.handler.class = null sasl.jaas.config = null sasl.kerberos.kinit.cmd = /usr/bin/kinit sasl.kerberos.min.time.before.relogin = 60000 sasl.kerberos.service.name = null sasl.kerberos.ticket.renew.jitter = 0.05 sasl.kerberos.ticket.renew.window.factor = 0.8 sasl.login.callback.handler.class = null sasl.login.class = null sasl.login.connect.timeout.ms = null sasl.login.read.timeout.ms = null sasl.login.refresh.buffer.seconds = 300 sasl.login.refresh.min.period.seconds = 60 sasl.login.refresh.window.factor = 0.8 sasl.login.refresh.window.jitter = 0.05 sasl.login.retry.backoff.max.ms = 10000 sasl.login.retry.backoff.ms = 100 sasl.mechanism = GSSAPI sasl.oauthbearer.clock.skew.seconds = 30 sasl.oauthbearer.expected.audience = null sasl.oauthbearer.expected.issuer = null sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000 sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000 sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100 sasl.oauthbearer.jwks.endpoint.url = null sasl.oauthbearer.scope.claim.name = scope sasl.oauthbearer.sub.claim.name = sub sasl.oauthbearer.token.endpoint.url = null security.protocol = PLAINTEXT security.providers = null send.buffer.bytes = 131072 socket.connection.setup.timeout.max.ms = 30000 socket.connection.setup.timeout.ms = 10000 ssl.cipher.suites = null ssl.enabled.protocols = [TLSv1.2, TLSv1.3] ssl.endpoint.identification.algorithm = https ssl.engine.factory.class = null ssl.key.password = null ssl.keymanager.algorithm = SunX509 ssl.keystore.certificate.chain = null ssl.keystore.key = null ssl.keystore.location = null ssl.keystore.password = null ssl.keystore.type = JKS ssl.protocol = TLSv1.3 ssl.provider = null ssl.secure.random.implementation = null ssl.trustmanager.algorithm = PKIX ssl.truststore.certificates = null ssl.truststore.location = null ssl.truststore.password = null ssl.truststore.type = JKS transaction.timeout.ms = 60000 transactional.id = null value.serializer = class org.apache.kafka.common.serialization.StringSerializer11:04:50.129 trace_id= span_id= trace_flags= INFO [Producer clientId=producer-1] Instantiated an idempotent producer.11:04:50.203 trace_id= span_id= trace_flags= INFO Kafka version: 3.4.111:04:50.203 trace_id= span_id= trace_flags= INFO Kafka commitId: 8a516edc2755df8911:04:50.203 trace_id= span_id= trace_flags= INFO Kafka startTimeMs: 171731909020311:04:50.581 trace_id= span_id= trace_flags= WARN [Producer clientId=producer-1] Error while fetching metadata with correlation id 1 : {bluetoothCountingDataBulk=LEADER_NOT_AVAILABLE}11:04:50.583 trace_id= span_id= trace_flags= INFO [Producer clientId=producer-1] Cluster ID: SStqQtL4TK-6DpN4NqMJrw11:04:50.698 trace_id= span_id= trace_flags= INFO [Producer clientId=producer-1] ProducerId set to 0 with epoch 011:04:50.703 trace_id= span_id= trace_flags= WARN [Producer clientId=producer-1] Error while fetching metadata with correlation id 5 : {bluetoothCountingDataBulk=LEADER_NOT_AVAILABLE}11:04:50.812 trace_id= span_id= trace_flags= INFO [Producer clientId=producer-1] Resetting the last seen epoch of partition bluetoothCountingDataBulk-0 to 0 since the associated topicId changed from null to 78gvCLt6RkahgisJjaw97wjava.util.concurrent.CompletableFuture@54d2f5d3[Not completed]java.util.concurrent.CompletableFuture@54d2f5d3[Completed normally]Wanted but not invoked:com.hitachirail.maas.acingestion.streaming.service.BCDProducerService#0 bean.publishOnKafkaOfficialTopic(<any>);-> at com.hitachirail.maas.acingestion.streaming.service.BCDProducerService.publishOnKafkaOfficialTopic(BCDProducerService.java:58)Actually, there were zero interactions with this mock.Wanted but not invoked:com.hitachirail.maas.acingestion.streaming.service.BCDProducerService#0 bean.publishOnKafkaOfficialTopic(<any>);-> at com.hitachirail.maas.acingestion.streaming.service.BCDProducerService.publishOnKafkaOfficialTopic(BCDProducerService.java:58)Actually, there were zero interactions with this mock. at com.hitachirail.maas.acingestion.streaming.service.BCDProducerService.publishOnKafkaOfficialTopic(BCDProducerService.java:58) at com.hitachirail.maas.acingestion.streaming.consumer.ExampleIntegrationTest.shouldSendTheMessage(ExampleIntegrationTest.java:141) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
What am I doing wrong?
I've tried so many ways, but unfortunately, the consumer is never invoked. The message in Kafka seems to be sent correctly.