txnmgr

Simple transaction management framework

License

License

GroupId

GroupId

com.github.dgrandemange
ArtifactId

ArtifactId

txnmgr
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

txnmgr
Simple transaction management framework
Project URL

Project URL

https://github.com/dgrandemange/txnmgr
Source Code Management

Source Code Management

https://github.com/dgrandemange/txnmgr.git

Download txnmgr

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.dgrandemange/txnmgr/ -->
<dependency>
    <groupId>com.github.dgrandemange</groupId>
    <artifactId>txnmgr</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.dgrandemange/txnmgr/
implementation 'com.github.dgrandemange:txnmgr:1.0.0'
// https://jarcasting.com/artifacts/com.github.dgrandemange/txnmgr/
implementation ("com.github.dgrandemange:txnmgr:1.0.0")
'com.github.dgrandemange:txnmgr:jar:1.0.0'
<dependency org="com.github.dgrandemange" name="txnmgr" rev="1.0.0">
  <artifact name="txnmgr" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.dgrandemange', module='txnmgr', version='1.0.0')
)
libraryDependencies += "com.github.dgrandemange" % "txnmgr" % "1.0.0"
[com.github.dgrandemange/txnmgr "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.6.4

test (4)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
junit : junit jar 4.11
org.easytesting : fest-assert jar 1.4
org.easytesting : fest-reflect jar 1.4

Project Modules

There are no modules declared in this project.

When you want some atomic tasks to be executed one after another following a specific workflow, and when you want those processed tasks to be cancelled if, at some point in the workflow, an unexpected error occurs, then this set of classes may help you.

Note : this project is very much inspired by jPos monetic framework's transaction manager concepts. It intends not to be an alternative nor a concurrent to the jPos transaction manager which works just fine. Rather, it provides some set of classes that are candidate to dependency injection through an IOC container (like for instance Spring).

Adding txnmgr to a Maven project

Add the following dependency section to your pom.xml : ``` com.github.dgrandemange txnmgr 1.0.0 ```

Recipee

First, think about your workflow and what should be done from a business point of view. Doing so, you should be able to identify the different tasks you need. We will call theses tasks participants. A participant has to be an implementation of the fr.dgrandemange.txnmgr.service.IParticipant interface.

In your workflow, there may be different ways for the job to be done, depending on the execution context. So, at some points in the workflow, some paths will be selected and some others won't.

So how is the selection done ?
Well, when a participant is processed (see method fr.dgrandemange.txnmgr.service.IParticipant.execute(IContextMgr contextMgr)), it can returns a space delimited list of group names. A group is an ordered list of participants.
When a group is selected, its participants are executed one after another, following the order of their declaration in the group.

All groups must be registered in a fr.dgrandemange.txnmgr.model.ParticipantsGroupRegistry and uniquely identified by a name.

The transaction is handled by a transaction manager. A basic implementation is provided with the fr.dgrandemange.txnmgr.service.support.TransactionMgrImpl class.

See a sample usage in this unit test.

Related projects

The [txnmgr-springframework-ext](https://github.com/dgrandemange/txnmgr-springframework-ext) project provides a nice way to configure (definition and external dependencies injection) participants (and groups of) through a Spring XML application context configuration.

The jPos Workflow Eclipse plugin project which provides a way to view a transaction workflow XML configuration as a directed graph under the Eclipse IDE.

Versions

Version
1.0.0