Hey guys,

I am new to Ignite and trying to implement a custom counter. I read the
document and it seems like I can implement my counter in three different
ways so need some help figuring out which approach to take.

//business logic in pseudo code

Ignite ignite = Ignition.ignite();
IgniteTransactions transactions = ignite.transactions();
try (Transaction tx = transactions.txStart()) {
    Account account = cache.get(accNbr);
   long amount =account.getAmount()
    account.updatedAmount(amount+10)
    cache.put(accNbr,account);
    tx.commit();
}

// end code

As far as I can tell, I can run this code

1) on the client side (maybe slow due to transaction?)
2) I can run it as IgniteCompute.affinityCall(...) on the grid itself. (I am
assuming I can start tx inside affinityCall)
3) Run this code as a Cluster Singleton behind a service

Please note that there could be multiple clients on different machines,
trying to update the same account so transaction locking is important. I am
leaning toward using affinityCall to implement this but was wondering
whether this is the correct approach?

Thanks




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

Reply via email to