-
1. Re: One transaction on two machines
sl4ve Aug 28, 2007 7:53 AM (in response to sl4ve)If you need any additional information - just let me know.
-
2. Re: One transaction on two machines
marklittle Aug 28, 2007 11:23 AM (in response to sl4ve)So if you're not using CORBA for transaction propagation, you can use RMI/IIOP, SOAP, JMS. What else do you need? Fundamentally you need some way of communicating the context and having the receiving side know what to do with it.
-
3. Re: One transaction on two machines
leilss Aug 28, 2007 10:18 PM (in response to sl4ve)I meet the same problem, and haven't get any solution yet. why the document doesn't give a brief configuration for this?
-
4. Re: One transaction on two machines
sl4ve Aug 29, 2007 3:05 AM (in response to sl4ve)As far as I remember all the examples in Programmers Guide was using CORBA. It was also said that before I use JBossTS I have to initialize ORB.
Because of this I assumed that the only way to propagate transaction is using CORBA, but now I know I was wrong.
What's still buggin' me that there's no brief guide how to use it.
Correct me if I'm wrong. I should begin a transaction with com.arjuna.ats.jta.TransactionManager class, do some work, and then? Should I use PropagationContextManager, getContext method and send it to the other application? And there I use importContext method and do the rest of work?
Could you tell me if I'm right? I would be grateful for any piece of example code.
Greets -
5. Re: One transaction on two machines
jhalliday Aug 29, 2007 5:34 AM (in response to sl4ve)Since the product is open source, you best bet is to look at the way the existing transports (CORBA or WS) work. However, if you are not using either of those, how do you plan to distribute the transaction control calls (begin/enlist/prepare/commit/rollback) ? That's a much larger task than just propagating the context.
-
6. Re: One transaction on two machines
sl4ve Aug 29, 2007 6:06 AM (in response to sl4ve)I want to distribute the transaction control calls via JBossESB messages.
Could you tell me what I achieve by just sending PropagationContext to another application? Because I'm lost at the moment and I don't know if I understand it correctly.
Anyways I will show you a part of my code and maybe you would have a clue why it's not working.
I got to applications, ServiceA and ServiceB.
ServiceA does something like that:javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); tm.begin(); PropagationContextManager pcm = new PropagationContextManager(); Object pc = pcm.getTransactionPropagationContext(); Message m = getMessage(); m.getBody().add("PropagationContext",pc); Courier c = getCourier(findEPR("service","B")); c.deliver(m);
ServiceB receives a message and tries to use the transaction that ServiceA began.Object pc = msg.getBody().get("PropagationContext"); javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); PropagationContextManager pcm = new PropagationContextManager(); pcm.importTransactionPropagationContext(pc); tm.commit();
When B gots a message then prints this:
[java] 11:55:53,812 DEBUG [pool-2-thread-1][PropagationContextManager] PropagationContextManager.importTransactionPropagationContext(Object) - called tpc = a843cfd:b7c:46d542a6:0
[java] 11:55:53,843 DEBUG [pool-2-thread-1][PropagationContextManager] PropagationContextManager.importTransactionPropagationContext(Object) - transaction = null
[java] 11:55:53,875 DEBUG [pool-2-thread-1][logger] BaseTransaction.commit
[java] java.lang.IllegalStateException: BaseTransaction.commit - [com.arjuna.ats.internal.jta.transaction.arjunacore.notx] [com.arjuna.ats.internal.jta.transaction.arjunacore.notx] no transaction!
[java] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:130)
[java] at slv.ServiceB.processMessage(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
[java] at org.jboss.soa.esb.listeners.message.OverriddenActionProcessor.process(OverriddenActionProcessor.java:99)
[java] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:262)
[java] at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:297)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
[java] at java.lang.Thread.run(Thread.java:595)
Maybe I miss some configuration? -
7. Re: One transaction on two machines
jhalliday Aug 29, 2007 6:48 AM (in response to sl4ve)> Could you tell me what I achieve by just sending PropagationContext to another application?
For the JBossTS JTA, absolutely nothing. In a distributed transaction system the transaction context contains two bits of information. One is the unique identifier for the transaction. The other is information that specifies the location of the transaction coordinator. In JTS that's a CORBA IOR, in WST it's a web services URL. The point is, it's specific to the transport used for the transaction control protocol, not the protocol used for the business method call on which the tx context is propagated. Before you worry about how to propagate the context you need to figure out what information goes into it. How are you exposing the transaction coordinator on your chosen transport? Once you know that you can create an appropriate context, then worry about how to propagate it. -
8. Re: One transaction on two machines
marklittle Aug 29, 2007 7:44 AM (in response to sl4ve)It's more than just propagating the context: you need to make sure that the receiver can do something with it, which usually involved thread-to-transaction association as well as interposition. Oh, and let's not forget distributed recovery. That's why JBossESB does not support transactions across anything other than Web Services or JMS (still to come, but will be there for the 4.2.1 GA release in September/October).
So while you are definitely on the right approach, it's definitely just the tip of the iceberg. -
9. Re: One transaction on two machines
sl4ve Aug 30, 2007 4:01 AM (in response to sl4ve)Could you advise my any source that I could read about basics which I need to know?
I'm a member of small trainee team and haven't been working with jboss for longer than 2 months now. We are to design and implement distributed transactions support for ESB. Isn't it exactly what you're going to do till September/October? -
10. Re: One transaction on two machines
sl4ve Aug 30, 2007 4:26 AM (in response to sl4ve)I have one more question. I'm afraid I know the answer, but I still have to ask it ;>.
Is there any way to begin a local transaction, suspend it, let an application terminate (but without any errors, exceptions etc) and then rerun the application and resume the former transaction? Do some extra work and commit/rollback it? -
11. Re: One transaction on two machines
jhalliday Aug 30, 2007 5:34 AM (in response to sl4ve)You can't do that with local transactions in the current implementation. You can with JTS transactions using a remote coordinator that does not get terminated and restarted, but even there it's going to require some careful work.
-
12. Re: One transaction on two machines
marklittle Aug 30, 2007 6:09 AM (in response to sl4ve)Why would you want to do that?
-
13. Re: One transaction on two machines
marklittle Aug 30, 2007 6:10 AM (in response to sl4ve)"SL4VE" wrote:
Could you advise my any source that I could read about basics which I need to know?
I'm a member of small trainee team and haven't been working with jboss for longer than 2 months now. We are to design and implement distributed transactions support for ESB. Isn't it exactly what you're going to do till September/October?
Yes, that's what will be in the 4.2.1 release. -
14. Re: One transaction on two machines
sl4ve Aug 30, 2007 6:24 AM (in response to sl4ve)I would like to do that, because there can be some situations when one application will call another one asynch. First application will terminate and when the second one ends its job then it will call back the first. Depending on the outcome of the second application's work the transaction begun at the beggining would be commited or rolled back.