TEXT I/O microservice¶
Metadata¶
- name:
saturnin.example.textio
- description:
Sample TEXTIO microservice
- classification:
example/micro
- OID:
None
- OID name:
None
- UUID:
7fe7a9fe-d60b-11e9-ad9f-5404a6a1fd6e
- facilities:
None
- API:
None
Description¶
This example demostrates Butler micro service that uses a data pipe (using FBDP protocol). It transfers text between a file and a data pipe.
It can:
operate in both ways, i.e. store data from pipe input to file, or read from file to pipe output.
work as data pipe server (bind) or client (connect)
operate on regular files or stdin, stdout and stderr
convert text between character sets (using MIME text/plain
charset
anderror
parameters)open output files in create (fails if file exists), write, append or rename (renames existing files).
The transfer unit is single text line, which is quite simple but very ineffective. For real use it would be better to transfer text in larger chunks (see Saturnin text reader and writer microservices).
Note
This sample service is fundamentally different from the saturnin.text.reader
and
saturnin.text.writer
services in that it can act as a provider or consumer as configured.
Saturnin CORE services saturnin.text.reader
, saturnin.text.writer
and saturnin.text.linefilter
are good examples of micro services that use data pipes in three different scenarios:
data producer
, data consumer
and data filter
.
Important
The MIME type for the transmitted data must be defined in an appropriate way that guarantees the correct processing of the data by the receiving service.
Configuration¶
- agent:
UUID
: Agent identification (service UUID)- logging_id:
str
: Logging ID for this component instance, see Context-based logging for details.- stop_on_close:
- data_pipe:
str
: Data Pipe Identification (name). REQUIRED option.- pipe_address:
ZMQAddress
: Data Pipe endpoint address. REQUIRED option.- pipe_mode:
SocketMode
: Data Pipe Mode (bind/connect). REQUIRED option.- pipe_format:
MIME
: Pipe data format specification. REQUIRED for CONNECT pipe mode. DEFAULTtext/plain;charset=utf-8
.- pipe_batch_size:
int
: Data batch size. See FBDP documentation for details. DEFAULT 50.- filename:
str
: File specification (path to file). REQUIRED option.- file_mode:
FileOpenMode
: File I/O mode.- file_format:
MIME
: File data format specification. REQUIRED option. DEFAULTtext/plain;charset=utf-8
Important
STDOUT, STDERR and STDIN support only READ and WRITE modes.