-
1. Re: JBossTS distributed without container JEE
tomjenkinson Aug 6, 2015 6:40 AM (in response to giovani.kli)Hi Giovani,
Yes this is something you can do with Narayana.
We have a number of options available for you from REST/XTS(SOAP) to CORBA. CORBA is actually the simplest of the options for propagating the context. We do have a standalone quickstart to show this in action: https://github.com/jbosstm/quickstart/tree/master/ArjunaJTS/trailmap/src/main/java/com/arjuna/demo/jts/explicitremotebank
Please do let me know if you need further assistance.
Tom
-
2. Re: JBossTS distributed without container JEE
tomjenkinson Aug 6, 2015 6:43 AM (in response to tomjenkinson)1 of 1 people found this helpfulAlso, you should find the following section of our project documentation useful: Narayana Project Documentation
-
3. Re: JBossTS distributed without container JEE
giovani.kli Aug 6, 2015 4:47 PM (in response to tomjenkinson)Hi Tim,
Thank you for the reply.
I´m going to try the explicitremotebank quickstart.
Now I guess that the real questions are:
1. How can I configure Spring to use Narayana JTS (distributed transactions)
2. What is the best way to propagate a transaction from one JVM to another one, using Spring + Narayana JTS. I guess that a good way is to use CORBA.
Thanks,
Giovani
-
4. Re: JBossTS distributed without container JEE
zhfeng Aug 7, 2015 4:35 AM (in response to giovani.kli)1 of 1 people found this helpfulThere is JBTM-855 Create an example showing integration with Spring and I'm working on it for JTA example. So I think it would be useful to have an JTS example.
Amos
-
5. Re: JBossTS distributed without container JEE
tomjenkinson Aug 7, 2015 7:55 AM (in response to zhfeng)I agree with Amos, I think we should try to include JTS in the example too. Giovani, there is a place to start from in the Jira that Amos linked to but its not for JTS.
Also, you might be able to infer some instructions for hooking up Narayana JTA in spring using: camelinaction/spring-context.xml at 7643a2fee2b296960c2f90753cc698df816e78a1 · zhfeng/camelinaction · GitHub
The thing that doesn't show is how to register the resources for recovery and for that you would need to simulate the standalone tactics in spring or run an out of process recovery manager: http://narayana.io/docs/project/index.html (grep it for recovery), or wait for JBTM-855 where Amos will have considered how to integrate with Spring for recovery and be able to quickstart it.
-
6. Re: JBossTS distributed without container JEE
geojacob Oct 5, 2015 8:29 AM (in response to giovani.kli)Hi Giovani,
Probably you can use RMI-IIOP as your protocol. Spring has 'JndiRmiServiceExporter' which exposes a spring service as JNDI accessible RMI service using iiop.
I guess this enables the implicit transaction context propagation when using narayana JTS.
Tom, is it possible to propagate context without implementing TransactionalObject at server side?
Thanks
George
-
7. Re: JBossTS distributed without container JEE
mmusgrov Oct 5, 2015 10:47 AM (in response to geojacob)To propagate the context when using IIOP you would need to register our ORBInitializers (via Java ORB properties as per the CORBA spec). These initializers install request interceptors that do the propagation.. We have different interceptors depending on which ORB is in use. For example,for the JavaIdj orb:
System.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.com.arjuna.ats.jts.orbspecific.javaidl.interceptors.interposition.InterpositionORBInitializerImpl", "com.arjuna.ats.jts.orbspecific.javaidl.interceptors.interposition.InterpositionORBInitializerImpl");
Now on the receiving side if you get hold of our (JTS) transaction manager and invoke getTransaction() on it then it will return a javax.transaction.Transaction instance corresponding to the transaction propagated from the client.
I am not sure if we have any simple integration tests that show this.
-
8. Re: JBossTS distributed without container JEE
geojacob Oct 6, 2015 3:13 AM (in response to giovani.kli)Thanks Mike
is this enough to setup arjuna ? should'nt we include the recommended setup config as below
ORB myORB = ORB.getInstance("orbInstance");
RootOA myOA = OA.getRootOA(myORB);
myORB.initORB(new String[] {}, null);
myOA.initOA();
ORBManager.setORB(myORB);
ORBManager.setPOA(myOA);
i think spring exporting will create an ORB for itself. How to tell spring to use the ORB which is being initialised from above code ?
-
9. Re: JBossTS distributed without container JEE
tomjenkinson Oct 6, 2015 7:18 AM (in response to geojacob)Hi George,
Try taking a look at one of our tests:
Fire up this one: https://github.com/jbosstm/narayana/blob/master/ArjunaJTS/jtax/tests/classes/com/arjuna/ats/jtax/tests/implicit/server/ImplicitServer.java
Then run the client against it from a different JVM: https://github.com/jbosstm/narayana/blob/master/ArjunaJTS/jtax/tests/classes/com/arjuna/ats/jtax/tests/implicit/client/ImplicitClient.java
The properties file is: narayana/jbossts-properties.xml at master · jbosstm/narayana · GitHub (both JVMs need it: -Dcom.arjuna.ats.arjuna.common.propertiesFile=jbossts-properties.xml)
Hope it helps,
Tom
-
10. Re: JBossTS distributed without container JEE
geojacob Oct 6, 2015 11:10 AM (in response to tomjenkinson)Hi Tom,
Awesome test cases. Easy to understand the core working !
Thanks for sharing this.
BTW this test case is for a pure CORBA based solution. We tried it over here and works great.
But our final intention is to make the server side object to a RMI-IIOP object so that we can configure it using the spring JNDIRMIExporter.
Here is the sample to setup with the help of a ORBD provided with SUN JDK.
<bean class="org.springframework.remoting.rmi.JndiRmiServiceExporter"> <property name="jndiName" value="HelloWorld"/> <property name="serviceInterface" value="com.sample.remote.IRemote" /> <property name="service" ref="helloWorldService"/> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial"> com.sun.jndi.cosnaming.CNCtxFactory </prop> <prop key="java.naming.provider.url">iiop://localhost:1050</prop> </props> </property> </bean>
So at the client side we look up 'HelloWorld' using jndi which will look like this.
<bean id="helloWorldService" class="org.springframework.remoting.rmi.JndiRmiProxyFactoryBean"> <property name="jndiName"> <value>HelloWorld</value> </property> <property name="serviceInterface"> <value>com.sample.remote.IRemote</value> </property> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial"> com.sun.jndi.cosnaming.CNCtxFactory </prop> <prop key="java.naming.provider.url">iiop://localhost:1050</prop> </props> </property></bean>
here the name 'HelloWorld' is bound to the ORBD started separately.
Am wondering how to configure this when we use narayana ORB Setup ? May be any additional properties to be supplied to "jndiEnvironment" so that spring takes the ORB initialized by the narayana JTS.
-
11. Re: JBossTS distributed without container JEE
tomjenkinson Oct 7, 2015 8:22 AM (in response to geojacob)Gonna be honest with you George - I am just not sure. It might be worth a query on the spring forums how to configure the ORB.
Sorry I can't be more help - I am just not familiar with Springzhfeng is looking into Spring but even then it will be the more simple local JTA integration initially. If you do get some good progress and have a simple example you can share I would love to add it to our quickstarts.
-
12. Re: JBossTS distributed without container JEE
geojacob Oct 8, 2015 5:52 AM (in response to tomjenkinson)Tom , thanks a ton
Sure i will post it to spring forum and concurrently dive into the spring core to see if something possible.
Update you soon
-
13. Re: JBossTS distributed without container JEE
tomjenkinson Oct 8, 2015 6:16 AM (in response to geojacob)Thanks George!