Repository navigation
Conversation
|
@vidakovic could you please give us feedback about this implementation? |
|
@vidakovic PTAL |
|
Thanks for the PR. The DOCUMENT CREATE/UPDATE/DELETE hooks now fire, which is what FINERACT-2536 asks for. Two things in the description don't match the code: 1. The root cause. The description says DOCUMENT webhooks stopped firing when FINERACT-2246 moved documents to the new command processing. They never fired. Before 2ff0c62 (FINERACT-2246), 2. "Same payload fields as the legacy path". It isn't the same. The legacy This matters beyond documents, because Please either:
Also please set up GPG signature and sign your commits |
5898dc6 to
f7578e3
Compare
|
Thanks @adamsaghy, you're right on both counts.
The commit was GPG-signed, but my public key wasn't on my GitHub account, so it didn't show as verified. I've added the key and force-pushed the re-signed commit. |
f7578e3 to
4d9355c
Compare
|
@adamsaghy PTAL |
adamsaghy
left a comment
There was a problem hiding this comment.
LGTM. Document create/update/delete now publish webhook events via HookableCommand, after commit, with the top-level officeId/clientId as in the legacy path; my earlier points are addressed. Please drop the LoanApplicationTermsTest commit when rebasing, develop already has that change.
Document commands have never notified webhooks subscribed to DOCUMENT events. Before FINERACT-2246, DocumentManagementApiResource called DocumentWritePlatformService directly instead of going through commandsSourceWritePlatformService, so the legacy SynchronousCommandProcessingService never published their HookEvents. The new CommandDispatcher runs its after-hooks, but none of them published one either. Add a HookableCommand interface through which a command declares the entity and action its webhooks subscribe to, and an after-hook that publishes the HookEvent for such commands. As in the legacy path, the office and client of the response are exposed at the top level of the payload, where the SMS hooks look up the client, publication waits for the enclosing transaction to commit, and a failure to publish is logged without failing the command. Unlike the legacy path, the request in the payload is the serialized request object rather than the raw JSON body. The document commands declare DOCUMENT CREATE, UPDATE and DELETE; other migrated commands can opt in the same way.
4d9355c to
84b415f
Compare
|
Rebased on develop and dropped the could you approve the workflow runs when you get a chance? |
Description
JIRA: https://issues.apache.org/jira/browse/FINERACT-2536
Document commands have never notified webhooks subscribed to DOCUMENT events. Before FINERACT-2246,
DocumentManagementApiResourcecalledDocumentWritePlatformServicedirectly instead of going throughcommandsSourceWritePlatformService, so the legacySynchronousCommandProcessingServicenever published theirHookEvents. The newCommandDispatcherruns its after-hooks, but none of them published one either. This adds the missing feature to the new command processing.Changes
HookableCommand(fineract-command): an opt-in interface through which a command declares the entity and action its webhooks subscribe to (hookEntityName()/hookActionName()).WebhookCommandHookAfter(fineract-core): aCommandHookAfterthat publishes theHookEventforHookableCommands. As in the legacy path, publication waits for the enclosing transaction to commit, and a failure to publish is logged without failing the command.Payload compared with the legacy path
entityName,actionName,createdBy,createdByName,createdByFullName,request,response,timestamp.officeId/clientId, they are copied to the top level of the payload andofficeIdis cleared insideresponse, as inSynchronousCommandProcessingService.TwilioHookProcessorandMessageGatewayHookProcessorlook up the client there, so SMS hooks work for migrated client commands that opt in. Document responses carry neither, so document payloads have no top-levelofficeId/clientId.requestis the serialized request DTO rather than the raw JSON body (e.g. the uploaded file content is not included).Other commands migrated to the new processing can opt in the same way; I kept this PR to documents and am happy to follow up for the rest.
Testing
WebhookCommandHookAfterTest: payload contents, top-levelofficeId/clientIdwhen the response provides them, commands that don't opt in are skipped, publication is deferred until after commit, and publish failures don't propagate.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.