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;

private ClientCache 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]> 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]>
> 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
> john.blum10101 (skype)
>



-- 

Saygılarımla, with my warm regards,

Ali KOYUNCU

Reply via email to