Val,

Thank you for the response. As per your suggestion I will first test it
with write through approach before moving to JTA.

About JTA, I still have some doubts about how to use it.

As per the example given in this link
https://apacheignite.readme.io/v2.4/docs/transactions (Integration With JTA
section
<https://apacheignite.readme.io/v2.4/docs/transactions#section-integration-with-jta>
),

I have few questions about following code.

1) As per the ignite doc, the transaction manager should be configured
suing TransactionConfiguration#setTxManagerFactory method and then this
transaction configuration should be set in ignite configuration.
  How do I get this transaction in my code?
  Does this code  "IgniteTransactions transactions =
ignite.transactions();" provides JTA transaction?
  How to and when to enlist jdbc data source in this transaction manager?

2) How to configure TMService bean ?

3) In following example how to enlist xa jdbc datasource in this
transaction? How xa resource for ignite cache is enlisted in transaction in
following example?



    // Get an instance of JTA transaction manager.
    TMService tms = appCtx.getComponent(TMService.class);

    // Get an instance of Ignite cache.
    IgniteCache<String, Integer> cache = cache();

    UserTransaction jtaTx = tms.getUserTransaction();

    // Start JTA transaction.
    jtaTx.begin();

    try{
    // Do some cache operations.
    cache.put("key1",1);
    cache.put("key2",2);

    // Commit the transaction.
    jtaTx.commit();
    }
    finally{
    // Rollback in a case of exception.
    if(jtaTx.getStatus()==Status.STATUS_ACTIVE)
    jtaTx.rollback();
    }


Thanks,
Prasad



On Tue, Mar 27, 2018 at 8:45 AM, vkulichenko <valentin.kuliche...@gmail.com>
wrote:

> Prasad,
>
> First, I'm not sure why you think write-though would be slower than using
> JTA. I'm probably missing something, but I believe you should at least test
> this before making decision.
>
> In any case, if you use JTA, Ignite would automatically enlist any cache
> operations into ongoing JTA transaction. You only need to do the following:
> - JTA transaction manager instance provided in Ignite's
> TransactionConfiguration is the same that starts transactions.
> - Cache operations are invoked within the same thread that started a
> transaction.
>
> Hope this helps.
>
> -Val
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to