-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix class loader issue for notifications response #38
Fix class loader issue for notifications response #38
Conversation
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
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.
Thanks for the fix!
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.
I love this as a start.
Try to refactor this where you don't need to override fun onResponse
manually in every instance.
I think I want to be able to write this:
wrapper.execute(
SEND_NOTIFICATION_ACTION_TYPE,
SendNotificationRequest(eventSource, channelMessage, channelIds, threadContext),
object: SomeNewType<ActionResponse, SendNotificationResponse>
}
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.
This should be refactored, and definitely needs tests to be merged.
I was trying to extract a |
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@joshuali925 excellent! Is it worth putting this into a method (e.g. client.execute(
DELETE_NOTIFICATION_CONFIG_ACTION_TYPE,
request,
listener
wrapActionListener(listener) { response -> recreateObject(response) { DeleteNotificationConfigResponse(it) } }
) I almost think that maybe this entire implementation is a map of |
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@dblock agree that could look cleaner, but in common-utils/src/main/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterface.kt Lines 218 to 225 in d5bcf10
|
Closing for #40 |
@joshuali925 @dblock I tried this idea but the code was not clean as I thought. This is mostly because of generic types and number fo params required by each execute call. I would suggest keeping it as is for now. |
Signed-off-by: Joshua Li joshuali925@gmail.com
Description
fix from @dai-chen:
Recreate the response object from
ActionResponse
as specific notifications response in notifications plugin interface to avoid classloader issue when passing response between pluginsIssues Resolved
#37
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.