-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/kafka setup #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/kafka setup #19
Conversation
Signed-off-by: Vladimir Fokin <115186975+scobca@users.noreply.github.com>
There was a problem hiding this 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 |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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.
import kotlin.text.toByteArray |
Copilot uses AI. Check for mistakes.
Qodana for JVM4 new problems were found
☁️ View the detailed Qodana report Detected 116 dependenciesThird-party software listThis page lists the third-party software dependencies used in cs-mail-service
Contact Qodana teamContact us at qodana-support@jetbrains.com
|
Closes #15