0

@Subscribe autoUnsubscribe is not working

asked 2022-04-28 08:13:43 +0800

wastemails gravatar image wastemails
130 1 2
@AfterCompose
public void doAfterCompose(@ContextParam(ContextType.VIEW) Component view,@ContextParam(ContextType.BINDER) Binder binder) {

    Object object = SelectorsExt.subscribeEventQueues(this);

    //SelectorsExt.ExtendedUtilityHandlerImpl extendedUtilityHandler = new SelectorsExt.ExtendedUtilityHandlerImpl();
    //extendedUtilityHandler.postSubscriptionHandling(object, view);


@Subscribe(value = "on.update", scope = "application", eventName = "on.update")
public void test(String value){

}

Above code is not autounSubscribing, if enabled commented lines only autoUnsubscribing is working.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-05-03 15:49:42 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2022-05-03 15:50:40 +0800

Auto-Unsubscribed only works when using SelectoComposer by default instead of a ViewModel. Please see Auto-Unsubscribed.

Since you call SelectorsExt.subscribeEventQueues(this); in a ViewModel, your @Subscribe still works and can receive events from an event queue.

If you check ServerPushEventQueue.subscribe(), it add a listener EQCleanup that will remove the subscriber's listener when a desktop is destroyed:

_dtInfos.put(desktop, di = new DesktopInfo(desktop, new EQService(), new EQCleanup()));

So, you don't need to call postSubscriptionHandling().

link publish delete flag offensive edit

Comments

Thankyou, do you mean "SelectorsExt.subscribeEventQueues(this);" is enough to take care auto Unsubscription when exited from respective viewModel?

wastemails ( 2022-05-05 17:21:31 +0800 )edit

yes, it adds a listener EQCleanup that will remove the subscriber's listener when a desktop is destroyed. just like unsubscribe.

hawk ( 2022-05-06 16:22:09 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2022-04-28 08:13:43 +0800

Seen: 5 times

Last updated: May 03 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More