Skip to content

[MODNOTES-295] Kafka producer foundation + Note create events#373

Open
Saba-Zedginidze-EPAM wants to merge 8 commits into
masterfrom
MODNOTES-295
Open

[MODNOTES-295] Kafka producer foundation + Note create events#373
Saba-Zedginidze-EPAM wants to merge 8 commits into
masterfrom
MODNOTES-295

Conversation

@Saba-Zedginidze-EPAM

@Saba-Zedginidze-EPAM Saba-Zedginidze-EPAM commented Jul 20, 2026

Copy link
Copy Markdown

Purpose

[MODNOTES-295] Kafka producer foundation + Note create events

Approach

  • Add necessary dependencies
  • Update application properties
  • Update docker setup
  • Implement new configuration and services
  • Use new implementation to send create events
  • Update unit tests
  • Create new ITs and a test consumer component

Changes Checklist

  • API Changes: Document any API paths, methods, request or response bodies changed, added, or removed.
  • Database Schema Changes: Indicate any database schema changes and their impact. Confirm that migration scripts were created.
  • Interface Version Changes: Indicate any changes to interface versions.
  • Interface Dependencies: Document added or removed dependencies.
  • Permissions: Document any changes to permissions.
  • Logging: Confirm that logging is appropriately handled.
  • Unit Testing: Confirm that changed classes were covered by unit tests.
  • Integration Testing: Confirm that changed logic was covered by integration tests.
  • Manual Testing: Confirm that changes were tested on local or dev environment.
  • NEWS: Confirm that the NEWS file is updated with relevant information about the changes made in this pull request.

Screenshots (if applicable)

image

Comment thread docker/README.md
@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +81 to +95
kafka-topic-init:
image: apache/kafka:latest
depends_on:
- kafka
environment:
KAFKA_HOST: kafka
KAFKA_PORT: 9093
ENV: ${ENV}
TENANTS: ${KAFKA_INIT_TENANTS}
KAFKA_TOPIC_PARTITIONS: ${KAFKA_TOPIC_PARTITIONS}
volumes:
- ./kafka-init.sh:/usr/bin/kafka-init.sh
entrypoint: ["bash", "/usr/bin/kafka-init.sh"]
networks:
- mod-notes-local

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't think this is needed as mod-notes doesn't consume any topic, so no external topics should be created. Topic for produce will be created during enabling tenant in the module.

Comment on lines +44 to +53
public void publish(UUID id, DomainEvent<Note> event) {
var topic = topicName();
try {
log.debug("publish:: sending Note event [topic: {}, id: {}, type: {}]", topic, id, event.getType());
kafkaTemplate.send(topic, id, event);
log.info("publish:: Note event sent [topic: {}, id: {}, type: {}]", topic, id, event.getType());
} catch (Exception e) {
log.error("publish:: failed to send Note event [topic: {}, id: {}, type: {}]", topic, id, event.getType(), e);
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Kafka message must have headers.

log.info("createNote:: created note by title: {}, domain: {}, type: {}",
note.getTitle(), note.getDomain(), note.getType());
return notesMapper.toDto(entity);
Note newSnapshot = notesMapper.toDto(entity);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

snapshot?

Comment on lines +51 to +53
kafka:
topics:
note: notes.note

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not see place where the topic is created.

import tools.jackson.databind.JsonNode;

@DisplayName("Note create domain events")
class NoteDomainEventIT extends TestApiBase {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think that separate test class is needed. It could be included in existed IT class.

@psmagin

psmagin commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Also please fix sonar issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants