-
Notifications
You must be signed in to change notification settings - Fork 0
DemoTail
This page describes how to setup and run a stream that tails a file. Spring Integration provides a File Tailing Inbound adapter.
as instructed in the Getting Started page.
The tail source has 3 options:
-
name: the absolute path to the file to tail (default:
/tmp/xd/input/<streamName>) -
lines: the number of lines from the end of an existing file to tail (default: 0)
-
delay: on platforms that don’t wait for a missing file to appear, how often (ms) to look for the file (default: 5000)
mkdir -p /tmp/xd/input
touch /tmp/xd/input/tailtest (1)
curl -X POST -d "tail | file" http://localhost:8080/streams/tailtest
echo blah >> /tmp/xd/input/tailtest
cat /tmp/xd/output/tailtest
-
Note: this step is not necessary on some platforms; for example, on Linux, the
tailcommand suspends when a missing file is tailed. However, on Mac OSX, thetailcommand exits in this situation. When this happens, the tail source keeps trying to open the file every 5 seconds. Since, by default, the tail source tails from the end of the file, some lines might be missed.
or
curl -X POST -d "tail --name=/tmp/foo --lines=5 | file --name=bar" http://localhost:8080/streams/tailtest
echo blah >> /tmp/foo
cat /tmp/xd/output/bar
Some platforms, such as linux, send status messages to stderr. The tail module sends these events to a logging adapter, at WARN level; for example…
[message=tail: cannot open `/tmp/xd/input/tailtest' for reading: No such file or directory, file=/tmp/xd/input/tailtest] [message=tail: `/tmp/xd/input/tailtest' has become accessible, file=/tmp/xd/input/tailtest]
Home | About | Project | Getting Started | Technical Docs