Skip to main content

dawdler-distributed-transaction-core

Module Introduction​

The distributed transaction core module, providing the transaction annotation and the concrete implementation.

1. Adding the dependency in pom​

<groupId>club.dawdler</groupId>
<artifactId>dawdler-distributed-transaction-core</artifactId>

2. The DistributedTransaction annotation​

@DistributedTransaction is applied to the methods of the transaction sponsor and the transaction participants.

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface DistributedTransaction {

String action();// Alias of the concrete Processor; refer to the argument passed to the DistributedTransactionCustomProcessor constructor, used to map to the transaction processor.

boolean sponsor() default false;// Whether this is the sponsor; defaults to participant.

int transactionTimeoutSeconds() default 0;// Transaction timeout (seconds); branches still in the trying state after this time are forcibly rolled back by the compensator. 0 means using the global default value defaultTransactionTimeoutSeconds; a timeout declared by the sponsor applies to the whole transaction.
}