Skip to content

Commit

Permalink
Revert "feat : using lombok"
Browse files Browse the repository at this point in the history
This reverts commit a7cc238.
  • Loading branch information
rajadilipkolli committed Dec 2, 2023
1 parent a7cc238 commit 0de746f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<configuration>
<java>
<palantirJavaFormat>
<version>2.38.0</version>
<version>2.30.0</version>
</palantirJavaFormat>
<importOrder/>
<removeUnusedImports/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@
import com.example.springbootkafka.multi.domain.SimpleMessage;
import jakarta.validation.Valid;
import java.util.concurrent.CountDownLatch;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

@Getter
@Component
@Slf4j
@Validated
public class JsonReceiver {

private final CountDownLatch latch = new CountDownLatch(1);

public CountDownLatch getLatch() {
return latch;
}

@KafkaListener(topics = TOPIC_TEST_2, containerFactory = "jsonKafkaListenerContainerFactory")
public void jsonListener(@Payload @Valid SimpleMessage cr) {
public void listen2(@Payload @Valid SimpleMessage cr) {
log.info(TOPIC_TEST_2 + " Received a message with key=" + cr.key() + ", value=" + cr.value());
latch.countDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
import static com.example.springbootkafka.multi.util.AppConstants.TOPIC_TEST_1;

import java.util.concurrent.CountDownLatch;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Getter
@Slf4j
@Component
public class SimpleReceiver {

private static final Logger logger = LoggerFactory.getLogger(SimpleReceiver.class);

private final CountDownLatch latch = new CountDownLatch(1);

public CountDownLatch getLatch() {
return latch;
}

@KafkaListener(topics = TOPIC_TEST_1, containerFactory = "simpleKafkaListenerContainerFactory")
public void simpleListener(ConsumerRecord<Integer, String> cr) {
log.info(TOPIC_TEST_1 + " Received a message with key=" + cr.key() + ", value=" + cr.value());
public void listen1(ConsumerRecord<Integer, String> cr) {
logger.info(TOPIC_TEST_1 + " Received a message with key=" + cr.key() + ", value=" + cr.value());
latch.countDown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TestSpringBootKafkaMultiApplication {
@Bean
@ServiceConnection
KafkaContainer kafkaContainer() {
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.5.2")).withKraft();
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.5.1")).withKraft();
}

public static void main(String[] args) {
Expand Down

0 comments on commit 0de746f

Please sign in to comment.