Book Image

Wildfly Cookbook

Book Image

Wildfly Cookbook

Overview of this book

Table of Contents (23 chapters)
WildFly Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating and removing XA-Datasource


XA-Datasources are just like normal datasources, except that they need a different driver-class-name and they support distributed transaction across heterogeneous transactional systems.

Imagine the classical example of an online store: a user buys an item, the item is removed from the stock database and an amount of money is subtracted from the user's bank account, which is an external system. Both the operations must succeed in order to proceed with payment and shipment.

This was just an example to give you the idea; we will not go any further.

Getting ready

The prerequisite of this recipe is the Getting ready section of the Creating and removing a datasource recipe.

How to do it…

  1. With a running WildFly server, open your command-line tool and connect to the CLI:

    $ ./bin/jboss-cli.sh --connect
    [standalone@localhost:9990 /]
  2. Now execute the following commands:

    [standalone@localhost:9990 /] batch
    [standalone@localhost:9990 / #] /subsystem=datasources/xa-data-source...