Name |
|
||||||
---|---|---|---|---|---|---|---|
Backends | JVM JavaScript | ||||||
Maven coordinates | |||||||
Compatible Ceylon release |
JVM: 1.2.x, 1.3.x (latest) JavaScript: 1.2.1, 1.2.2, 1.3.x (latest) |
||||||
Published | Jan 19, 2017 | ||||||
Stats |
Downloads (JVM): 229 Downloads (JS): 59 Source downloads: 304 |
||||||
Description |
A module for writing Ceylon daemons that communicate over a system-provided socket. UsageThe simplest way to write a daemon is to use one of the abstractions layered over this module,
such as This module itself offers an asynchronous, callback-based server that sends and receives bytes. Each instance mainly consists of a callback that is called whenever data is read from the socket; it can also write to the socket and register a callback to be called when the write is finished. Per-instance error handling may also be configured. This implements a basic “ shared void run() => start { function instance(void write(ByteBuffer content, WriteCallback callback), void close()) { void read(ByteBuffer content) { write(content, noop); } return [read, logAndAbort(`module`)]; } fd = 3; }; For details, please see the documentation of The server process should inherit a socket file descriptor from the process that launched it,
e. g. the inetd superserver (or a derivative like xinetd) or the systemd system manager.
The choice of file descriptor (the The following systemd unit files may be used as a baseline for daemon unit files
(placed, for example, in # ceylond.service [Service] # JVM backend ExecStart=/usr/bin/java -jar /path/to/ceylond.jar # JS backend ExecStart=/usr/bin/node -e "require('de/lucaswerkmeister/ceylond/1.0.0/de.lucaswerkmeister.ceylond-1.0.0').run()" Environment=NODE_PATH=/path/to/node_modules # ceylond.socket [Socket] ListenStream=/var/run/ceylond/ceylond.sock The daemon can then be activated with LoggingThis module (and its companion modules, listed above) makes use of [[module ceylon.logging]]. If you [[register|ceylon.logging::addLogWriter]] a log writer, it will also receive messages from this module. This module also includes a log writer that emits messages to standard error
in a format recognized by the systemd journal: Backend-specific limitations
|
||||||
Dependencies |
|
||||||
Usage |
import de.lucaswerkmeister.ceylond.core "1.0.0"; |
||||||
Module links |
Members Imported By Browse Download .car Download .js Download source archive Download module documentation View API documentation |