Re: affinityRun then invoke

2017-08-30 Thread Evgenii Zhuravlev
Hi,

It's not necessary to use affinityRun when you invoke EntryProcessor -
EntryProcessor allows for processing data directly on primary nodes.

I would recommend you to check this example: https://github.com/apache/
ignite/blob/master/examples/src/main/java/org/apache/
ignite/examples/datagrid/CacheEntryProcessorExample.java
It covers the simple use case of EntryProcessor, it will show you how
EntryProcessor should be used.

Evgenii


2017-08-30 16:39 GMT+03:00 matt <goodie...@gmail.com>:

> I'm using @AffinityKeyMapped to ensure that all items of a particular
> field (the "parent" in my case) are processed on the same node. When I want
> to process an entree, I'm essentially doing 
> ignite.compute().affinityRun("my-cache",
> key, () -> this::processEntry); where processEntry does: cache.invoke(key,
> (entry, args) -> { if( entry.exists() ){ modify(entry); } else {
> create(entry); } return true; }); Is this generally a valid way to deal
> with atomically updating entrees within a partitioned cache? Thanks, - Matt
> --
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>


Re: affinityRun then invoke

2017-08-30 Thread Ilya Lantukh
Hi Matt,

In your case ignite.compute().affinityRun(...) is redundant - if you simply
call cache.invoke(...), it will send your EntryProcessor to the primary
node for the specified key, where it will be executed.

Hope this helps.

On Wed, Aug 30, 2017 at 4:39 PM, matt  wrote:

> I'm using @AffinityKeyMapped to ensure that all items of a particular
> field (the "parent" in my case) are processed on the same node. When I want
> to process an entree, I'm essentially doing 
> ignite.compute().affinityRun("my-cache",
> key, () -> this::processEntry); where processEntry does: cache.invoke(key,
> (entry, args) -> { if( entry.exists() ){ modify(entry); } else {
> create(entry); } return true; }); Is this generally a valid way to deal
> with atomically updating entrees within a partitioned cache? Thanks, - Matt
> --
> Sent from the Apache Ignite Users mailing list archive
>  at Nabble.com.
>



-- 
Best regards,
Ilya


affinityRun then invoke

2017-08-30 Thread matt
I'm using @AffinityKeyMapped to ensure that all items of a particular field
(the "parent" in my case) are processed on the same node. When I want to
process an entree, I'm essentially
doingignite.compute().affinityRun("my-cache", key, () ->
this::processEntry);where processEntry does:cache.invoke(key, (entry, args)
-> {  if( entry.exists() ){ modify(entry); } else { create(entry); }  return
true;});Is this generally a valid way to deal with atomically updating
entrees within a partitioned cache?Thanks,- Matt



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/