ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arunkjn <arun...@gmail.com>
Subject Transactions and IgniteQueue
Date Fri, 03 Nov 2017 09:43:07 GMT
Hi,

I am using an optimistic transaction with serializable isolation level on a
transactional cache as follows-

while (true){
                try(Transaction tx =
ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.SERIALIZABLE)){

                    // update all keys of workflow run state corresponding
to this event
                    flowRunStateIds.stream().forEach(flowRunStateId -> {
                        FlowRunState state =
workflowRunStateIgniteCache.get(flowRunStateId);
                        try {
                            state.getFlowRunEvents().put(event);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        workflowRunStateIgniteCache.put(flowRunStateId,
state);
                    });

                    updatedFlows.stream().forEach(workflowFlow ->
updatedFlowsIgniteQueue.put(workflowFlow));

                    tx.commit();
                    break;
                }
                catch (TransactionOptimisticException e){
                    // todo: emit a monitoring metric TRANSACTIONS_FAILED
here
                    System.out.println("Transaction failed. Retrying...");
                }
            }

Inside the transaction I am updating the cache values and also updating an
IgniteQueue updatedFlowsIgniteQueue. If the transaction fails at the time of
commit, the transactional cache will not be updated. Is the same also true
for IgniteQueue? Also, will my queue be locked during the duration of the
transaction?

Thanks,
Arun



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

Mime
View raw message