Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Distributed Transactions and Remoting

Hello,

I have three pu's:

puClient
pu1
pu2

pu1 exposes a remoting service - service1 - that writes to space1
pu2 exposes a remoting service - service2 - that writes to space2

puClient wants to invoke service1 followed by service2, with both operations contained in a transaction.

Here are a few questions about how to achieve this:

1. How should puClient be configured? Should it acquire its space and service proxies in code, or can/should some of this work be done in pu.xml?

2. Where/how should it invoke the distributed transaction manager?

3. Should it manage the transaction programatically or can/should it do it declaratively? The doc. (see below) seems to state that the client must manage the transaction declaratively, but I can't find a way to make this work.

4. Should the service methods be annotated as @Transactional?

5. Should the space proxies used by remoted methods to access the spaces have transaction managers attached to them? Local or distributed?

At the moment I have:

puClient acquires all proxies in code.

pu1 and pu2 acquire their space proxies and attach local transaction managers to them in their pu.xmls.

service1 and service2 are @Transactional.

Each of the space operations is transactional but, of course, they are not part of the same transaction. I have tried to find a way to get the client to initiate a declarative transaction, but I haven't found the magic formula.

In other cases where the client is writing directly to a clustered space via a remote proxy, I can achieve distributed transactionality by attaching the distributed transaction manager to the proxy and working programatically. In the case I am working on now, however, the client is dealing with two proxies (to access the services offered by pu1 and pu2) so I think I have to establish the proxies in code as opposed to config. Having established the proxies in code, I think I have to use programmatic transaction control, but it seems that services won't join programmatic transactions.

I have puzzled over the doc.:

===========
Sync remoting supports transactional execution of services. On the client side, if there is an ongoing declarative transaction during the service invocation (a Space based transaction), the service will be executed under the same transaction. The transaction itself is passed to the server and any Space related operations (performed using GigaSpace) will be executed under the same transaction. The transaction lifecycle itself is controlled on the client side (declaratively) and is committed / rolled back only on the client side. (Note, exceptions on the server side will simply propagate to the client side, and will cause a rollback only if the client "decides" so.)

When using broadcast with sync remoting, a declarative distributed transaction must be used and not a local (or JTA one). Also note, the GigaSpace instance that is used internally by the sync remoting invocation must be configured with a transaction manager (as is the case for enabling transaction execution with any other GigaSpace based operation).
=========

and done many experiments. At this point I would greatly appreciate some expert advice.

Many thanks.

-Dan

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2009-03-14 18:18:32 -0600

subuta gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

I hacked my way through this.

BTW, it appears (subject to verification of course) that declarative transactions cannot be initiated from within timer methods in PUs. Perhaps this is related to the confirmed issue that declarative transactions cannot be initiated by remoting services unless the service export is declared explicitly in the pu.xml.

answered 2009-03-15 09:33:51 -0600

subuta gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2009-03-14 18:18:32 -0600

Seen: 102 times

Last updated: Mar 15 '09