Loading pom.xml +0 −10 Original line number Diff line number Diff line Loading @@ -102,16 +102,6 @@ <artifactId>sharding-jdbc-orchestration-spring-namespace</artifactId> <version>${sharding-sphere.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring</artifactId> <version>${sharding-sphere.spi.impl.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring-boot-starter</artifactId> <version>${sharding-sphere.spi.impl.version}</version> </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId> Loading sharding-proxy-example/sharding-proxy-boot-mybatis-example/pom.xml +0 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,6 @@ <version>${project.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> Loading sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/SpringBootStarterTransactionExample.javadeleted 100755 → 0 +0 −53 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis; import org.apache.shardingsphere.example.common.service.CommonService; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ComponentScan; @ComponentScan("org.apache.shardingsphere.example") @MapperScan(basePackages = "org.apache.shardingsphere.example.common.mybatis.repository") @SpringBootApplication(exclude = JtaAutoConfiguration.class) public class SpringBootStarterTransactionExample { public static void main(final String[] args) { try (ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringBootStarterTransactionExample.class, args)) { CommonService sagaTransactionService = (CommonService) applicationContext.getBean("sagaTransactionService"); CommonService xaTransactionService = (CommonService) applicationContext.getBean("xaTransactionService"); processTransaction(sagaTransactionService); processTransaction(xaTransactionService); } } private static void processTransaction(final CommonService transactionService) { transactionService.initEnvironment(); transactionService.processSuccess(); try { transactionService.processFailure(); } catch (final Exception ex) { transactionService.printData(); } finally { transactionService.cleanEnvironment(); } } } sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/service/SagaTransactionalService.javadeleted 100755 → 0 +0 −72 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis.service; import org.apache.shardingsphere.example.common.mybatis.service.SpringPojoService; import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType; import org.apache.shardingsphere.transaction.core.TransactionType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Component("sagaTransactionService") public class SagaTransactionalService implements CommonService { private final SpringPojoService springPojoService; @Autowired public SagaTransactionalService(final SpringPojoService jpaCommonService) { this.springPojoService = jpaCommonService; } @Override public void initEnvironment() { springPojoService.initEnvironment(); } @Override public void cleanEnvironment() { springPojoService.cleanEnvironment(); } /** * process success, XA transaction will be committed. */ @Override @ShardingTransactionType(TransactionType.BASE) @Transactional public void processSuccess() { springPojoService.processSuccess(); } /** * process failure, XA transaction will be rollback. */ @Override @ShardingTransactionType(TransactionType.BASE) @Transactional public void processFailure() { springPojoService.processFailure(); } @Override public void printData() { springPojoService.printData(); } } sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/service/XATransactionalService.javadeleted 100755 → 0 +0 −72 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis.service; import org.apache.shardingsphere.example.common.mybatis.service.SpringPojoService; import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType; import org.apache.shardingsphere.transaction.core.TransactionType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Component("xaTransactionService") public class XATransactionalService implements CommonService { private final SpringPojoService springPojoService; @Autowired public XATransactionalService(final SpringPojoService springPojoService) { this.springPojoService = springPojoService; } @Override public void initEnvironment() { springPojoService.initEnvironment(); } @Override public void cleanEnvironment() { springPojoService.cleanEnvironment(); } /** * process success, XA transaction will be committed. */ @Override @ShardingTransactionType(TransactionType.XA) @Transactional public void processSuccess() { springPojoService.processSuccess(); } /** * process failure, XA transaction will be rollback. */ @Override @ShardingTransactionType(TransactionType.XA) @Transactional public void processFailure() { springPojoService.processFailure(); } @Override public void printData() { springPojoService.printData(); } } Loading
pom.xml +0 −10 Original line number Diff line number Diff line Loading @@ -102,16 +102,6 @@ <artifactId>sharding-jdbc-orchestration-spring-namespace</artifactId> <version>${sharding-sphere.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring</artifactId> <version>${sharding-sphere.spi.impl.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring-boot-starter</artifactId> <version>${sharding-sphere.spi.impl.version}</version> </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId> Loading
sharding-proxy-example/sharding-proxy-boot-mybatis-example/pom.xml +0 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,6 @@ <version>${project.version}</version> </dependency> <dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-transaction-proxy-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> Loading
sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/SpringBootStarterTransactionExample.javadeleted 100755 → 0 +0 −53 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis; import org.apache.shardingsphere.example.common.service.CommonService; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ComponentScan; @ComponentScan("org.apache.shardingsphere.example") @MapperScan(basePackages = "org.apache.shardingsphere.example.common.mybatis.repository") @SpringBootApplication(exclude = JtaAutoConfiguration.class) public class SpringBootStarterTransactionExample { public static void main(final String[] args) { try (ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringBootStarterTransactionExample.class, args)) { CommonService sagaTransactionService = (CommonService) applicationContext.getBean("sagaTransactionService"); CommonService xaTransactionService = (CommonService) applicationContext.getBean("xaTransactionService"); processTransaction(sagaTransactionService); processTransaction(xaTransactionService); } } private static void processTransaction(final CommonService transactionService) { transactionService.initEnvironment(); transactionService.processSuccess(); try { transactionService.processFailure(); } catch (final Exception ex) { transactionService.printData(); } finally { transactionService.cleanEnvironment(); } } }
sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/service/SagaTransactionalService.javadeleted 100755 → 0 +0 −72 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis.service; import org.apache.shardingsphere.example.common.mybatis.service.SpringPojoService; import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType; import org.apache.shardingsphere.transaction.core.TransactionType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Component("sagaTransactionService") public class SagaTransactionalService implements CommonService { private final SpringPojoService springPojoService; @Autowired public SagaTransactionalService(final SpringPojoService jpaCommonService) { this.springPojoService = jpaCommonService; } @Override public void initEnvironment() { springPojoService.initEnvironment(); } @Override public void cleanEnvironment() { springPojoService.cleanEnvironment(); } /** * process success, XA transaction will be committed. */ @Override @ShardingTransactionType(TransactionType.BASE) @Transactional public void processSuccess() { springPojoService.processSuccess(); } /** * process failure, XA transaction will be rollback. */ @Override @ShardingTransactionType(TransactionType.BASE) @Transactional public void processFailure() { springPojoService.processFailure(); } @Override public void printData() { springPojoService.printData(); } }
sharding-proxy-example/sharding-proxy-boot-mybatis-example/src/main/java/org/apache/shardingsphere/example/proxy/spring/boot/mybatis/service/XATransactionalService.javadeleted 100755 → 0 +0 −72 Original line number Diff line number Diff line /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.example.proxy.spring.boot.mybatis.service; import org.apache.shardingsphere.example.common.mybatis.service.SpringPojoService; import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType; import org.apache.shardingsphere.transaction.core.TransactionType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Component("xaTransactionService") public class XATransactionalService implements CommonService { private final SpringPojoService springPojoService; @Autowired public XATransactionalService(final SpringPojoService springPojoService) { this.springPojoService = springPojoService; } @Override public void initEnvironment() { springPojoService.initEnvironment(); } @Override public void cleanEnvironment() { springPojoService.cleanEnvironment(); } /** * process success, XA transaction will be committed. */ @Override @ShardingTransactionType(TransactionType.XA) @Transactional public void processSuccess() { springPojoService.processSuccess(); } /** * process failure, XA transaction will be rollback. */ @Override @ShardingTransactionType(TransactionType.XA) @Transactional public void processFailure() { springPojoService.processFailure(); } @Override public void printData() { springPojoService.printData(); } }