SimpleIO (SIO) is a feature of Zato that allows one to develop services in a way that is reusable across multiple data formats and transports.
That is, a service can be written once but it is still possible to expose it, for instance, via XML through AMQP, and via JSON over HTTP, all from the single source code without any programming needed.
Once a service has been deployed, no code changes nor restarts are needed to make it available over various access methods.
An SIO service is one which has an inner class named SimpleIO that conforms to a certain API. Here is an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from zato.server.service import Service
class MyService(Service):
class SimpleIO:
input = 'name', 'type'
output = 'is_allowed'
def get_data(self):
if self.request.input.name == 'Wendy' and self.request.input.type == 'AXC':
return True
def handle(self):
self.response.payload.is_allowed = self.get_data()
|
Save it in an sio_example.py file, hot-deploy it and new channels for the service can be added immediately now - each independent and possibly using a different data format without influencing any other channel using the same service.
Each chapter is concerned with a particular aspect of SIO.
Chapter | Notes |
---|---|
Quick tutorial | A brief introduction to SimpleIO - creates a new service and exposes it through a few independent channels, each with its own data format without any changes to code |
How to declare input and output | How to declare a service’s input and output parameters in an idiomatic way |
Understanding SimpleIO data types | There is a range of SIO data types, each with its own options, all of them documented in this chapter |
I/O data formats available | Each SIO service can accept and produce messages in several formats, all of which are documented here |
Configuration files | Parts of SIO are configurable - learn more about the options available |
Generating API documentation | An SIO service can be automatically exposed via OpenAPI or WSDL, learn the details in this chapter |
Usage example for various data formats and channels | JSON, XML, SOAP, CSV, POST |
Version | Notes |
---|---|
3.2 |
|
3.0 | Introduced simple-io.conf to keep built-in and custom SimpleIO configuration in Added new types:
Added new options:
|
2.0 | Added new types:
|
1.0 | Added initially |
Feb 10, 2021