-
Notifications
You must be signed in to change notification settings - Fork 4
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
[MODSOURCE-840] Extend domain event with source MARC #664
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 1cb5237.
.onSuccess(v -> recordDomainEventPublisher.publishRecordUpdated(oldRecord, | ||
updatedRecord | ||
.withErrorRecord(oldRecord.getErrorRecord()) | ||
.withRawRecord(oldRecord.getRawRecord()) |
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.
Is this correct? Here we assign oldRecord.getRawRecord()
to updatedRecord
. Same comment on previous line .withErrorRecord(oldRecord.getErrorRecord())
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.
Yes, it is correct, but I already removed this piece of code because we decided not to send raw records and error records to make the domain event less overwhelmed with unneeded data
return getRecordById(txQE, oldRecord.getId()) | ||
.compose(optionalRecord -> optionalRecord.map(exisitngRecord -> | ||
insertOrUpdateRecord(txQE, oldRecord).compose(r -> insertOrUpdateRecord(txQE, newRecord)) | ||
.onSuccess(updatedRecord -> recordDomainEventPublisher.publishRecordUpdated(exisitngRecord, updatedRecord, okapiHeaders))) |
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.
typo in exisitngRecord
. Should be existingRecord
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.
Fixed, thanks
.compose(optionalRecord -> optionalRecord.map(exisitngRecord -> | ||
insertOrUpdateRecord(txQE, oldRecord).compose(r -> insertOrUpdateRecord(txQE, newRecord)) | ||
.onSuccess(updatedRecord -> recordDomainEventPublisher.publishRecordUpdated(exisitngRecord, updatedRecord, okapiHeaders))) | ||
.orElse(Future.failedFuture(new NotFoundException(format(RECORD_NOT_FOUND_TEMPLATE, oldRecord.getId()))))); |
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.
Per the existing logic, we insert new record to DB if the record do not already exist. Per the new logic, new throw NotFoundException when record do not exist in DB. Is it ok? (I don't know as I am not familiar with this module)
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.
It's ok because this method updates the existing oldRecord
and creates newRecord
, so we expect to have oldRecord
at DB before executing insert operation
Hi @RomanChernetskyi, Changes looks good to me except few minor comments. This change is going to break mod-linked-data application. Is it possible to wait few days for merging this PR? We will create a ticket & make changes in linked data per the new event payload. Here is my understanding about the payload change: Before:
After this change:
@PBobylev What do you think? May be we can make change in linked-data soon? If the payload change I mentioned above is correct, I think this is a minor change in linked-data. |
@@ -48,7 +55,7 @@ public Future<String> handle(KafkaConsumerRecord<String, String> consumerRecord) | |||
logInput(authorityId, eventSubType, tenantId); | |||
return (switch (eventSubType) { | |||
case SOFT_DELETE -> performSoftDelete(authorityId, tenantId); |
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.
Shouldn't it be a delete event on soft delete?
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.
So far, we decided to send an update on the soft delete of Marc's records, but during further refinements, requirements could be changes
Quality Gate passedIssues Measures |
Here is the PR to do the corresponding change in mod-linked-data: folio-org/mod-linked-data#111 |
@RomanChernetskyi Here is the corresponding change in mod-linked-data folio-org/mod-linked-data#111 |
Purpose
Create/Update/Delete operations in the module should generate related events with the new/old body for the entity (instances/authorities)
Acceptance Criteria:
Approach
Send domain events with old and new record
Jira
https://folio-org.atlassian.net/browse/MODSOURCE-840