An application publishes data, and one or more clients are listening. How do you solve these issues?
- The application publishes infrequently, but a client would like the data more often;
- The application is waiting for more input, but a client (which perhaps has just connected and thus might have missed the previous output) would like to know the last output line published.
csv-repeat will pass stdin to stdout, repeating the last record after a period of inactivity.
It might be useful to know if the data is from the original application, or being repeated. csv-repeat can decorate the output with additional fields:
Or perhaps you'd like the lines to be timestamped also:
And of course csv-repeat supports binary data with --binary=<format>.
csv-repeat can also act as a watchdog on a data stream. In the following example, it will exit, if the input stream fails to send an update on time:
You could use it to raise an alarm without disconnecting from the data producer. E.g. if you want to exit after 3 timeouts, you could write: