-
Notifications
You must be signed in to change notification settings - Fork 0
CROSSLINK-209 lms/ncip event logging #391
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
Changes from all commits
eb49018
165ffc1
c77dfc2
bc7d185
891d58f
834e5e8
e760cc2
a32e786
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| DELETE FROM event_config WHERE event_name ='lms-requester-message'; | ||
| DELETE FROM event_config WHERE event_name ='lms-supplier-message'; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| INSERT INTO event_config (event_name, event_type, retry_count) | ||
| VALUES ('lms-requester-message', 'NOTICE', 1); | ||
| INSERT INTO event_config (event_name, event_type, retry_count) | ||
| VALUES ('lms-supplier-message', 'NOTICE', 1); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,20 @@ func (a *PatronRequestActionService) handleBorrowingAction(ctx common.ExtendedCo | |
| if err != nil { | ||
| return events.LogErrorAndReturnResult(ctx, "failed to create LMS adapter", err) | ||
| } | ||
| lmsAdapter.SetLogFunc(func(outgoing []byte, incoming []byte, err error) { | ||
| status := events.EventStatusSuccess | ||
| if err != nil { | ||
| status = events.EventStatusError | ||
| } | ||
| var customData = make(map[string]any) | ||
| customData["lmsOutgoingMessage"] = string(outgoing) | ||
| customData["lmsIncomingMessage"] = string(incoming) | ||
| eventData := events.EventData{CustomData: customData} | ||
|
Comment on lines
+138
to
+141
|
||
| _, createErr := a.eventBus.CreateNotice(pr.ID, events.EventNameLmsRequesterMessage, eventData, status, events.EventDomainPatronRequest) | ||
| if createErr != nil { | ||
| ctx.Logger().Error("failed to create LMS log event", "error", createErr) | ||
| } | ||
| }) | ||
| switch action { | ||
| case BorrowerActionValidate: | ||
| return a.validateBorrowingRequest(ctx, pr, lmsAdapter) | ||
|
|
@@ -162,6 +176,20 @@ func (a *PatronRequestActionService) handleLenderAction(ctx common.ExtendedConte | |
| if err != nil { | ||
| return events.LogErrorAndReturnResult(ctx, "failed to create LMS adapter", err) | ||
| } | ||
| lms.SetLogFunc(func(outgoing []byte, incoming []byte, err error) { | ||
| status := events.EventStatusSuccess | ||
| if err != nil { | ||
| status = events.EventStatusError | ||
| } | ||
| var customData = make(map[string]any) | ||
| customData["lmsOutgoingMessage"] = string(outgoing) | ||
| customData["lmsIncomingMessage"] = string(incoming) | ||
| eventData := events.EventData{CustomData: customData} | ||
| _, createErr := a.eventBus.CreateNotice(pr.ID, events.EventNameLmsSupplierMessage, eventData, status, events.EventDomainPatronRequest) | ||
| if createErr != nil { | ||
| ctx.Logger().Error("failed to create LMS log event", "error", err) | ||
| } | ||
| }) | ||
| switch action { | ||
| case LenderActionValidate: | ||
| return a.validateLenderRequest(ctx, pr, lms) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.