Introducing BST

Zato Business State Transitions (BST) is a newly added extension to the core Zato integration platform designed for ESB, SOA, REST, APIs and Cloud Integrations in Python.

Screenshot

BST is a perfect fit for workflow-oriented integrations with multiple applications, Python-based or not, cooperating with a shared definition of a process, such as ones found in Order Management.

Definitions

Definitions of business states and their transitions are written in natural languages, such as English, for instance:

Orders
------

Objects: Order, Priority order
New: Submitted
Submitted: Ready
Ready: Sent
Sent: Confirmed, Rejected
Rejected: Updated
Updated: Ready
Force stop: Canceled, Timed out

Python API

From a Python's programmer perspective, everything boils down to a single with block in a Zato service which:

  • enforces that a given transition is correct for a provided business object
  • executes the block of code
  • on success, transitions the object to a new state
# Zato
from zato.server.service import Service

# zato-labs
from zato_bst import transition_to

class MyService(Service):

  def handle(self):

    with transition_to(self, 'Order', 123, 'ready'):

      # Here goes the actual user code
      pass

REST API

External applications, no matter if in Python, Java, .NET or employing any other technology, can always participate in transitions by using a BST REST API.

Below curl is used to simulate a sample transition for an object of type Customer whose ID is 2 to a state called "Consent given" in a hypothetical process of opening a customer account.

$ cat cust.json
{
 "object_type":"Customer",
 "object_id":"2",
 "state_new":"Consent given"
}
$
$ curl http://localhost:17010/bst/transition -d @cust.json
{"response":
 {
  "can_transition": true,
  "state_old": null,
  "state_new": "Consent given",
  "reason": ""
  }
}

The full API additionally allows to:

  • confirm a transition is valid before executing it
  • perform a mass transition of multiple business objects
  • get history of transitions for a business object
  • return a list of transitions defined in a Zato cluster

Exports and diagramming

A REST API is also available to export existing BST data to either JSON or diagrams, including both definitions and run-time information about the state of a BST instance.

Full control over output is offered, including means to specify custom colors, diagram size or timezones the data should be presented in:

Screenshot

Summary

BST offers new, interesting, means to extend one's SOA or REST environments with a new perspective on how to approach integrations that are primarily oriented towards workflows built on top of individual APIs and endpoints.

Click here to learn more about BST and the the core Zato platform upon which it's based.