Skip to content
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

[Push Plugin] Not able to invoke afterNotify Method #1590

Open
J-artz opened this issue Dec 8, 2024 · 2 comments
Open

[Push Plugin] Not able to invoke afterNotify Method #1590

J-artz opened this issue Dec 8, 2024 · 2 comments
Labels
status: confirming Confirming whether the issue is a bug or can be a new feature

Comments

@J-artz
Copy link

J-artz commented Dec 8, 2024

Hi James, I am implementing the push plugin, here is my flow

  1. push plugin successfully loaded. NotificationPusher#Start( ) breakpoint can be hit.
  2. change the code below so it will propagate to notifyRelatedUsersOfAction0#afterNotify
    default Mono<RequestHandlerResult> beforeNotify(
            @NotNull RequestHandlerResult result,
            @NotNull Long requesterId,
            @NotNull DeviceType requesterDevice) {
        return Mono.just(result);
    }
  1. Able to hit the breakpoint in
return mono
                .map(offlineRecipientIds -> pluginManager.invokeExtensionPointsSequentially(
                        RequestHandlerResultHandler.class,
                        RESULT_AFTER_NOTIFY_METHOD,
                        result,
  1. From debugging ,I can see it goes to PluginManager#invokeExtensionPointsSequentially and everything looks fine , the variable are correct.
    image
    image

  2. I expect it will go to the push plugin NotificationPusher#afterNotify( ) but it not able to hit the endpoint I set.

I am using the code provided in official push plugin and my step seems correct, but I wonder why it never invoke the afterNotify( ). Any help is appreciated ~~

@JamesChenX JamesChenX added the status: confirming Confirming whether the issue is a bug or can be a new feature label Dec 9, 2024
@J-artz
Copy link
Author

J-artz commented Dec 13, 2024

@JamesChenX Hi , James , it is able to work after I change it to

map:
Mono<OfflineIds> -> Mono<Mono<Result>>  (nested, inner Mono never executes)
Here, map just transforms the value but doesn't "flatten" the resulting Mono. So you end up with a Mono<Mono<Result>>, and the inner Mono (containing the afterNotify call) never gets subscribed to.
flatMap:
Mono<OfflineIds> -> Mono<Result>  (flattened, inner Mono executes)
flatMap both transforms and "flattens" the resulting Mono. It subscribes to the inner Mono returned by invokeExtensionPointsSequentially, which means the afterNotify actually gets executed.

@JamesChenX
Copy link
Member

Good catch! Could you help create a PR for the bugfix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirming Confirming whether the issue is a bug or can be a new feature
Projects
None yet
Development

No branches or pull requests

2 participants