Skip to content

Conversation

scobca
Copy link
Member

@scobca scobca commented Aug 15, 2025

Closes #15

@scobca scobca self-assigned this Aug 15, 2025
@Copilot Copilot AI review requested due to automatic review settings August 15, 2025 10:47
@scobca scobca added enhancement New feature or request medium priority labels Aug 15, 2025
@scobca scobca merged commit a67f972 into main Aug 15, 2025
1 check passed
@scobca scobca deleted the feat/kafka-setup branch August 15, 2025 10:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Kafka integration for the mail service, setting up infrastructure to handle email sending tasks through Kafka messaging. The implementation includes consumer configuration, custom serialization, and topic management.

  • Adds Kafka configuration with bootstrap servers and consumer properties
  • Implements email sending task consumer with custom serialization
  • Creates topic configuration and security setup for the mail service

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/resources/application.yaml Adds Kafka bootstrap servers and consumer configuration
src/main/kotlin/org/careerseekers/csmailservice/services/kafka/consumers/KafkaEmailSendingConsumer.kt Implements Kafka consumer for email sending tasks
src/main/kotlin/org/careerseekers/csmailservice/services/kafka/consumers/CustomKafkaConsumer.kt Defines generic Kafka consumer interface
src/main/kotlin/org/careerseekers/csmailservice/serializers/PolymorphicKafkaSerializer.kt Implements custom Kafka serializer for polymorphic DTOs
src/main/kotlin/org/careerseekers/csmailservice/serializers/CustomSerializerModule.kt Extends serializer module with Kafka message types
src/main/kotlin/org/careerseekers/csmailservice/security/SecurityConfig.kt Adds BCrypt password encoder configuration
src/main/kotlin/org/careerseekers/csmailservice/enums/MailEventTypes.kt Defines mail event types enum
src/main/kotlin/org/careerseekers/csmailservice/enums/KafkaTopics.kt Defines Kafka topics enum
src/main/kotlin/org/careerseekers/csmailservice/dto/KafkaMessagesDto.kt Creates DTOs for Kafka messaging
src/main/kotlin/org/careerseekers/csmailservice/config/kafka/consumers/EmailSendingConsumerConfig.kt Configures Kafka consumer factory and listener
src/main/kotlin/org/careerseekers/csmailservice/config/KafkaConfig.kt Sets up Kafka topic configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

backoff:
ms: 1000
max:
ms: 20000
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The session timeout configuration is inconsistent between YAML (60000ms) and Java config (20000ms in EmailSendingConsumerConfig.kt line 43). This could lead to unexpected behavior as the Java configuration will override the YAML settings.

Copilot uses AI. Check for mistakes.

consumerRecord: ConsumerRecord<String, EmailSendingTaskDto>,
acknowledgment: Acknowledgment
) {
println(consumerRecord.value())
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using println for logging in production code is not recommended. Consider using a proper logging framework like SLF4J with a logger instance.

Suggested change
println(consumerRecord.value())
logger.info("Received message: {}", consumerRecord.value())

Copilot uses AI. Check for mistakes.

import org.springframework.kafka.support.Acknowledgment

interface CustomKafkaConsumer<T, K> {
fun receiveMessage(consumerRecord: ConsumerRecord<T, K>, acknowledgment: Acknowledgment): Any
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type 'Any' is too generic and provides no meaningful contract. Consider using 'Unit' if no return value is needed, or define a specific return type that represents the operation result.

Suggested change
fun receiveMessage(consumerRecord: ConsumerRecord<T, K>, acknowledgment: Acknowledgment): Any
fun receiveMessage(consumerRecord: ConsumerRecord<T, K>, acknowledgment: Acknowledgment): Unit

Copilot uses AI. Check for mistakes.

import org.springframework.stereotype.Component
import kotlin.collections.isEmpty
import kotlin.collections.toString
import kotlin.text.toByteArray
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These explicit imports from kotlin.collections and kotlin.text are unnecessary as these functions are available by default. Remove these imports to clean up the code.

Suggested change
import kotlin.text.toByteArray

Copilot uses AI. Check for mistakes.

Copy link

Qodana for JVM

4 new problems were found

Inspection name Severity Problems
Unreachable code 🔶 Warning 4

☁️ View the detailed Qodana report

Detected 116 dependencies

Third-party software list

This page lists the third-party software dependencies used in cs-mail-service

Dependency Version Licenses
annotations 23.0.0 Apache-2.0
antlr4-runtime 4.13.0 BSD-3-Clause
aspectjweaver 1.9.24 BSD-3-Clause
checker-qual 3.33.0 MIT
checker-qual 3.49.3 MIT
classmate 1.7.0 Apache-2.0
dotenv-spring-boot 1.0.0 MIT
error_prone_annotations 2.23.0 Apache-2.0
failureaccess 1.0.1 Apache-2.0
flyway-core 11.7.2 Apache-2.0
flyway-database-postgresql 11.7.2 PostgreSQL
grpc-api 1.63.0 Apache-2.0
grpc-client-spring-boot-starter 3.1.0.release Apache-2.0
grpc-common-spring-boot 3.1.0.release Apache-2.0
grpc-core 1.63.0 Apache-2.0
grpc-inprocess 1.63.0 Apache-2.0
grpc-netty-shaded 1.63.0 Apache-2.0
grpc-protobuf-lite 1.57.2 Apache-2.0
grpc-protobuf 1.57.2 Apache-2.0
grpc-server-spring-boot-starter 3.1.0.release Apache-2.0
grpc-services 1.63.0 Apache-2.0
grpc-stub 1.57.2 Apache-2.0
guava 32.0.1-android Apache-2.0
hikaricp 6.3.1 Apache-2.0
j2objc-annotations 2.8 Apache-2.0
jackson-annotations 2.19.2 Apache-2.0
jackson-core 2.19.2 Apache-2.0
jackson-databind 2.19.2 Apache-2.0
jackson-dataformat-toml 2.19.2 OML
jackson-datatype-jdk8 2.19.2 Apache-2.0
jackson-datatype-jsr310 2.19.2 Apache-2.0
jackson-module-parameter-names 2.19.2 Apache-2.0
jakarta.activation-api 2.1.3 BSD-3-Clause
jakarta.annotation-api 2.1.1 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.mail 2.0.3 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.persistence-api 3.1.0 BSD-3-Clause
EPL-2.0
jakarta.transaction-api 2.0.1 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.validation-api 3.0.2 Apache-2.0
javax.annotation-api 1.3.2 CDDL-1.0
GPL-2.0-only
ORACLE-OPENJDK-EXCEPTION-2.0
jaxb-api 2.3.0 CDDL-1.1
GPL-2.0-only
ORACLE-OPENJDK-EXCEPTION-2.0
jboss-logging 3.6.1.final Apache-2.0
jjwt-api 0.12.6 Apache-2.0
jjwt 0.12.6 Apache-2.0
jsr305 3.0.2 Apache-2.0
jul-to-slf4j 2.0.17 MIT
kafka-clients 3.9.1 Apache-2.0
kotlin-stdlib 2.1.20 Apache-2.0
lettuce-core 6.6.0.release MIT
listenablefuture 9999.0-empty-to-avoid-conflict-with-guava Apache-2.0
log4j-api 2.24.3 Apache-2.0
log4j-to-slf4j 2.24.3 Apache-2.0
logback-classic 1.5.18 EPL-1.0
LGPL-2.0-or-later
logback-core 1.5.18 EPL-1.0
LGPL-2.0-or-later
lz4-java 1.8.0 Apache-2.0
mapstruct 1.5.3.final Apache-2.0
micrometer-commons 1.15.2 Apache-2.0
micrometer-core 1.15.2 Apache-2.0
micrometer-jakarta9 1.15.2 Apache-2.0
micrometer-observation 1.15.2 Apache-2.0
netty-common 4.1.123.final Apache-2.0
postgresql 42.7.7 BSD-2-Clause
proto-google-common-protos 2.17.0 Apache-2.0
protobuf-java 4.28.2 BSD-3-Clause
reactive-streams 1.0.4 MIT-0
reactor-core 3.7.8 Apache-2.0
reactor-kotlin-extensions 1.2.3 Apache-2.0
redis-authx-core 0.1.1-beta2 MIT
slf4j-api 2.0.17 MIT
snakeyaml 2.4 Apache-2.0
snappy-java 1.1.10.5 Apache-2.0
spring-aop 6.2.9 Apache-2.0
spring-aspects 6.2.9 Apache-2.0
spring-beans 6.2.9 Apache-2.0
spring-boot-actuator-autoconfigure 3.5.4 Apache-2.0
spring-boot-actuator 3.5.4 Apache-2.0
spring-boot-autoconfigure 3.5.4 Apache-2.0
spring-boot-configuration-processor 3.5.4 Apache-2.0
spring-boot-devtools 3.5.4 Apache-2.0
spring-boot-starter-actuator 3.5.4 Apache-2.0
spring-boot-starter-cache 3.5.4 Apache-2.0
spring-boot-starter-data-jpa 3.5.4 Apache-2.0
spring-boot-starter-data-redis 3.5.4 Apache-2.0
spring-boot-starter-jdbc 3.5.4 Apache-2.0
spring-boot-starter-json 3.5.4 Apache-2.0
spring-boot-starter-logging 3.5.4 Apache-2.0
spring-boot-starter-mail 3.1.5 Apache-2.0
spring-boot-starter-security 3.5.4 Apache-2.0
spring-boot-starter-tomcat 3.5.4 Apache-2.0
spring-boot-starter-validation 3.5.4 Apache-2.0
spring-boot-starter-web 3.5.4 Apache-2.0
spring-boot-starter 3.5.4 Apache-2.0
spring-boot 3.5.4 Apache-2.0
spring-context-support 6.2.9 Apache-2.0
spring-context 6.2.9 Apache-2.0
spring-core 6.2.9 Apache-2.0
spring-data-commons 3.5.2 Apache-2.0
spring-data-jpa 3.5.2 Apache-2.0
spring-data-keyvalue 3.5.2 Apache-2.0
spring-data-redis 3.5.2 Apache-2.0
spring-expression 6.2.9 Apache-2.0
spring-jdbc 6.2.9 Apache-2.0
spring-kafka 3.3.8 Apache-2.0
spring-messaging 6.2.9 Apache-2.0
spring-orm 6.2.9 Apache-2.0
spring-oxm 6.2.9 Apache-2.0
spring-retry 2.0.12 Apache-2.0
spring-security-config 6.5.2 Apache-2.0
spring-security-core 6.5.2 Apache-2.0
spring-security-web 6.5.2 Apache-2.0
spring-tx 6.2.9 Apache-2.0
spring-web 6.2.9 Apache-2.0
spring-webmvc 6.2.9 Apache-2.0
tomcat-embed-core 10.1.43 Apache-2.0
CDDL-1.0
PROPRIETARY-LICENSE
tomcat-embed-el 10.1.43 Apache-2.0
tomcat-embed-websocket 10.1.43 Apache-2.0
zstd-jni 1.5.6-4 BSD-2-Clause
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat | configure Kafka for mailer
1 participant