Add Dynamic Subscriber Interface#36
Closed
Fedik wants to merge 3 commits intojoomla-framework:3.x-devfrom
Closed
Conversation
4 tasks
|
I'm not a fan of this, at least in the cms I wouldn't like to have the overhead of dynamic loading on boot |
Author
|
It not replacement, but an optional addittion when you need some kind of "private listeners". This approach is much better than existing This also allows to removeSubscriber() and "unload" the plugin, unlike other 2 approaches which is kind of "one way". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Current limitation of
SubscriberInterfaceis that it does not allow to return listeners depend from runtime.It has own pros and cons. However in CMS it is sometimes need to have a diffrenet listeners depend from the Application type.
I think
DynamicSubscriberInterfacewill be a good for it.The difference from
SubscriberInterfaceis that it uses non-static method, which allows subscriber to configure listeners depending on runtime. Additionally, it supports callables.Example it allows to use
LazyServiceEventListenerand protected callbacks,which is not possible with
SubscriberInterface:The subscriber should implement only one of these interfaces, implementing both is not allowed (but we can discuss it of course).
Testing Instructions
Test is passes
Documentation Changes Required
New interfaces:
DynamicSubscriberInterfaceandDispatcherDynamicSubscriberInterface.