apache/shardingsphere-example

example for sharding-transaction-xa-narayana.

Opened this issue · 7 comments

narayana have provided a powerful feature to persistence transaction log into database, and do recovery in background thread. we'd like to write a example for it.

  • sharding-transaction-xa-narayana-raw-jdbc

@cherrylzhao I just want to know how to run the example of transaction-xa-raw-jdbc-example ?
for narayana example, I think it could be add the profile to include the dependency

<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-transaction-xa-narayana-manager</artifactId>

and if we want to use the jdbc to save the transaction log, we need to include the jbosstx-properties.xml which contains the jdbc configuration.

first create schema in your local mysql using manual_schema.sql
then run the YamlConfigurationTransactionExample is ok.

Well, how to run YamlConfigurationTransactionExample ? I tried

java -jar target/transaction-xa-raw-jdbc-example-4.0.0-RC2-SNAPSHOT.jar

but it looks like "target/transaction-xa-raw-jdbc-example-4.0.0-RC2-SNAPSHOT.jar中没有主清单属性"

mvn exec:java -Dexec.mainClass="org.apache.shardingsphere.example.transaction.xa.raw.jdbc.YamlConfigurationTransactionExample"

java.lang.NullPointerException
    at org.apache.shardingsphere.example.transaction.xa.raw.jdbc.YamlConfigurationTransactionExample.getFile (YamlConfigurationTransactionExample.java:52)
    at org.apache.shardingsphere.example.transaction.xa.raw.jdbc.YamlConfigurationTransactionExample.main (YamlConfigurationTransactionExample.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:748)

It looks like it can not find the configuration yaml file in the class resources. So can you show me the commands to run this example ?

we usually run the YamlConfigurationTransactionExample within idea.
if you want to run in command line, you should assembly it using maven-assembly-plugin

I think you can reference the assembly script of jdbc-performance-test

Thanks @cherrylzhao - I will try this test. Anyway, it could be very helpful to add some documentation to describe how to run the example even within the IDE.

ok, I will consider about it.