I would like to suggest, adding "add-cache-listener" option in addition to "remove-cache-listener." As adding listeners is as difficult as removing when doing alter region.
So alter region will have following options, 1) add-cache-listener - Will add provided cache listener to existing list. 2) remove-cache-listener - Will remove provided cache listeners. (Here we may consider passing empty list will remove all listeners) And old option of cache-listeners will be removed to eliminate confusion. On Thu, Jan 5, 2017 at 5:51 PM, Zhang Xiawei <zhang_xia...@hotmail.com> wrote: > Not sure whether I misunderstand/miss something or not, but isn't it > possible that you have multiple instances of the same type of > CacheListener? like 2 of ListenerTypeA and 3 of ListenerTypeB, so either > way shown below modifies at a "category" level? > > -Xiawei > > > On 5 Jan 2017, at 1:25 AM, Anthony Baker <aba...@pivotal.io> wrote: > > > > Another consideration is that gfsh commands should be easily scriptable, > IMO. > > > > If I want to remove just one of the N listeners using this approach, I > would need to acquire the list of existing listeners, remove the deselected > listener, format the list, then pass it to this command. Is there a way to > do this in one simple command? > > > > Anthony > > > >> On Jan 3, 2017, at 11:08 AM, Kirk Lund <kl...@apache.org> wrote: > >> > >> +1 I'm for the approach you're proposing. As long as it's documented in > >> user docs (it's not currently) then this provides a straightforward use > of > >> the existing gfsh syntax without introducing too many new command > options. > >> > >> Create the region with two cache listeners: > >> $ create region --name=data > >> --cache-listener="my.package.ListenerTypeA,my.package.ListenerTypeB" > >> > >> Change my mind and decide to remove one of the cache listeners: > >> $ alter region --name=data --cache-listener="my.package.ListenerTypeB" > >> > >> -Kirk > >> > >> > >>> On Tue, Jan 3, 2017 at 10:52 AM, Kevin Duling <kdul...@pivotal.io> > wrote: > >>> > >>> Is this an intuitive User Experience? > >>> > >>> Given these two classes: > >>> > >>> public class ListenerTypeA extends CacheListenerAdapter implements > >>> Declarable > >>> > >>> and > >>> > >>> public class ListenerTypeB extends CacheListenerAdapter implements > >>> Declarable > >>> > >>> And they are programmatically added to a region: > >>> > >>> CacheListener listener1 = new ListenerTypeA(); > >>> > >>> CacheListener listener2 = new ListenerTypeB(); > >>> > >>> Region region = cache.<String, > >>> Customer>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) > >>> > >>> .initCacheListeners(new CacheListener[]{listener1, > >>> listener2}).create("regionA"); > >>> > >>> > >>> What would the expected gfsh command to remove them. Should we remove > the > >>> listeners via omission? For example, removing listener1 might be: > >>> > >>> alter region --name=data --cache-listener='my.package.ListenerTypeB' > >>> > >>> > >>> By only listing the listeners I want...either to keep and/or to add, > >>> listener1 which is a ListenerTypeA, would be removed. > >>> > >>> > >>> > >>> > >>> > >>>> On Tue, Dec 20, 2016 at 2:11 PM, Kevin Duling <kdul...@pivotal.io> > wrote: > >>>> > >>>> I'm looking at GEODE-2236 > >>>> <https://issues.apache.org/jira/browse/GEODE-2236> and protecting > >>> against > >>>> the NPE is trivial. But the question is, what is the right way to do > >>>> this? What is the syntax people would expect to use? > >>>> > >>>> > >>>> What if there are multiple listeners and you wanted to delete one or > more > >>>> of them? > > > -- From: Deepak D Dixit deepakdixit2...@gmail.com +919028507537