Hi there Ali,

When you say "it does not fetch any event" do you mean you are inserting/updating data entries on the server and the client does not get notified? Or are you making changes on the client and not being notified?

CacheListeners or CacheWriters should fire when you are making your local region (in your case client).

In order to have events propagated from the server to the client you need to use "registerInterest" on your client region. This can be turned on:

1. enable subscriptions on your client pool, by setting
   "subscriptions-enabled=true"
2. On the client region set
   "operationRegion.registerInterest("ALL_KEYS",
   InterestResultPolicy.KEYS_VALUES)

After this any changes on the server will be propagated to your client.

Is this the functionality you are looking for?

--Udo

On 24/05/2016 2:00 am, Ali Koyuncu wrote:
John,

My code as as follows:

this.listener = new OperationCacheListener();
this.OperationRegion = cache
.<String, iEvent>createClientRegionFactory(ClientRegionShortcut.PROXY)
.initCacheListeners(new CacheListener[]
   {this.listener})
.addCacheListener(this.listener)
.create(OperationRegionName);


where;

private Region<String, iEvent> OperationRegion;

privateClientCache cache;

Despite I registered the listener, it doesn't fetch any event.

Is the above code segment true?

On Mon, May 23, 2016 at 6:49 PM, John Blum <[email protected] <mailto:[email protected]>> wrote:

    Hi Ali-

    You need to register the CacheListener on the /Region/ in which
    the data access operations/entry events (gets/puts/etc) are taking
    place.  E.g. ...

    ClientRegionFactory operationRegionFactory =
    clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY);

    *operationRegionFactory.addCacheListener(new
    OperationCacheListener());*
    operatonRegionFactory. ...

    Region operation = operationRegionFactory.create("Operation");

    -John


    On Mon, May 23, 2016 at 1:24 AM, Ali Koyuncu
    <[email protected] <mailto:[email protected]>> wrote:

        Dear all,

        I created a region named Operation.

        What I want to do is to get notified upon creating or updating
        record in this region.

        Following are my code segments:

        *Listener (named /OperationCacheListener/):*
        *
        *
        **public void afterCreate(EntryEvent event) {
           iEvent message = (iEvent) event.getNewValue();
           if(message instanceof CmdStartCSS)
           {
        logger.debug("[OperationCacheListener][Command: Start][Key: {}]");
        try {
        CmdStartCSS command = (CmdStartCSS) event.getNewValue();
        DialManager.getInstance().Start(command);
        }
        catch(Exception e)
        {
        logger.error("[OperationCacheListener][Start][{}][Exception:
        {}]", e.getClass().getSimpleName(), e.getMessage());
        }
           }
           else if(message instanceof CmdStopCSS)
           {
        logger.debug("[OperationCacheListener][Command: Stop][Key: {}]");
        try {
        DialManager.getInstance().Stop();
        } catch (Exception e) {
        //
        }
           }
          }
          public void afterUpdate(EntryEvent event)
          {
         System.err.println("Region entry was updated.");
          }
        *
        *
        *
        *
        *How I initiate the listener:*
        *
        *
        this.listener = new OperationCacheListener();
        this.OperationRegion = cache
        .<String,
        iEvent>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
        .initCacheListeners(new CacheListener[]
           {this.listener})
        .create(OperationRegionName);


        *PROBLEM:*
        *
        *
        When I am to create/update a record in this region, my events
        are not triggered.

        Could you please check and tell me where I am wrong or
        missing? (If you have a sample code on this matter, I will be
        glad).

        Thank you in advance.

--
        Saygılarımla, with my warm regards,

        Ali KOYUNCU




-- -John
    503-504-8657 <tel:503-504-8657>
    john.blum10101 (skype)




--

Saygılarımla, with my warm regards,

Ali KOYUNCU

Reply via email to