Skip to content

CIRCSTORE-419: Implement Kafka LOG_RECORD Event publishing and remove PubSub infrastructure - #592

Open
mukhiddin-yusuf wants to merge 10 commits into
masterfrom
circstore-419
Open

mukhiddin-yusuf wants to merge 10 commits into
masterfrom
circstore-419

Conversation

@mukhiddin-yusuf

@mukhiddin-yusuf mukhiddin-yusuf commented Aug 28, 2026

Copy link
Copy Markdown

Purpose

Replace publishing of LOG_RECORD pub-sub event with Kafka event/message producing to the same name topic. Remove existing pub-sub dependency and all the related code.

Approach

  • define LOG_RECORD Kafka topic which is created and owned my mod-audit
  • add Kafka publisher class for log records
  • replace pub-sub log record event publishing with KafkaLogRecordPublisher in RequestExpirationService and retain the structure/schema for the sent log records
  • remove pub-sub infrastructure

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.

Related Issues

CIRCSTORE-419

…blishing

- Delete pub-sub production classes: EventPublisherService, PubSubPublishingService,
  PubSubRegistrationService, EventType, ModulePubSubUnregisteringException,
  MessagingDescriptor.json
- Remove mod-pubsub-client dependency from pom.xml
- Remove pub-sub requires/modulePermissions from ModuleDescriptor-template.json
- Clean TenantRefAPI: remove pub-sub registration/unregistration, keep createKafkaTopics only
- Fix KafkaLogRecordPublisher: use KafkaProducerRecord.create(..., payload.encode()) instead
  of KafkaProducerRecordBuilder.value(JsonObject) to avoid Jackson mis-serialization
- Wire LogEventPayloadField and LogEventType enums into RequestExpirationService
- Delete test pub-sub infra: MockServer, EventPublisherServiceTest,
  CreateKafkaTopicsOrRegisterPubSubTest, test MessagingDescriptor.json
- StorageTestSuite: remove MockServer and pub-sub WireMock stub; create audit.LOG_RECORD
  Kafka topic at suite startup via KafkaAdminClientService
- TenantRefApiTests: remove pub-sub stubFor calls
- EventConsumerVerticleTest: remove OkapiConnectionParams imports, use string literals
- FakeKafkaConsumer: add LOG_RECORD topic subscription, logRecordEvents map,
  getLogRecordEvents(), clearLogRecordEvents()
- RequestExpirationApiTest: replace MockServer.getPublishedEvents with assertLogRecordEvents
  backed by FakeKafkaConsumer
Comment thread src/main/java/org/folio/service/KafkaLogRecordPublisher.java Outdated
Comment thread src/main/java/org/folio/service/KafkaLogRecordPublisher.java Outdated
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

* @param okapiHeaders Okapi headers propagated as Kafka record headers
* @return always-succeeded {@code Future<Void>}; send errors are logged but not propagated
*/
public Future<Void> publish(String key, JsonObject payload, Map<String, String> okapiHeaders) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why can't this method be a part of the abstract parent class?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants