I must have some syntax wrong, because I'm not able to add a cache listener
from the gfsh command line out of the jar I deployed.

ListenerTypeA and ListenerTypeB exist in the package 'geode' in my
custard-1.0-SNAPSHOT.jar.  I'm able to add those programmatically as I
showed earlier.

So that I could try to add these via gfsh, I changed my region creation
line to:

Region region = cache.<String,
Customer>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create("regionA");


Then I go through the standard steps of starting a locator, server, region,
and deploy my jar.

Now when I try to assign the listener, I get:


gfsh>alter region --cache-listener="geode.ListenerTypeA" --name=/regionA

Member | Status

------ |
-----------------------------------------------------------------------------------

server | ERROR: Could not find class "geode.ListenerTypeA" specified for
"cache-listener".


Am I doing something wrong, or is this not working as expected?  I wasn't
able to find documentation that illustrates how this should work.  The best
I could find was:
http://geode.apache.org/docs/guide/developing/events/cache_event_handler_examples.html


On Tue, Jan 3, 2017 at 11:52 AM, John Blum <jb...@pivotal.io> wrote:

> `describe region` will show the CacheListeners registered on a Region.
>
> On Tue, Jan 3, 2017 at 11:44 AM, Dave Barnes <dbar...@pivotal.io> wrote:
>
> > What gfsh command (if any) lists the cache-listeners available on a given
> > region? Seems like if the intention is to support adding and deleting by
> > name, there should be a way to list existing names.
> >
> > On Tue, Jan 3, 2017 at 11:29 AM, Jinmei Liao <jil...@pivotal.io> wrote:
> >
> > > +1 for remove by specifying only the ones you want to keep:
> > >
> > > $ alter region --name=data --cache-listener="" will remove all the
> cache
> > > listeners
> > >
> > > On Tue, 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?
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Cheers
> > >
> > > Jinmei
> > >
> >
>
>
>
> --
> -John
> john.blum10101 (skype)
>

Reply via email to