-
Notifications
You must be signed in to change notification settings - Fork 0
Streams
In Spring XD, a basic stream defines the ingestion of data from a source to a sink. Streams are managed using the StreamServer from the spring-xd-dirt subproject and defined in terms of source and sink modules. Modules are predefined configurations for sources and sinks and examples can be found in the modules directory within the spring-xd project [1]. When you ask the StreamServer to set up a new stream, it looks in the modules directory for the source and sink definitions.
The StreamServer is a prototype implementation for managing streams [2]. You can start it by running ./gradlew launch from the root directory. It exposes a REST API (at the /streams) endpoint to which you can post commands to define new streams. The commands are built from a simple DSL. For example, let’s walk through what happens if we execute the following request
$ curl -X POST -d "testsource | testsink" http://localhost:8080/streams/mystream
The DSL uses the "pipe" symbol |, to connect a source to a stream. The stream server finds the testsource and testsink definitions in the modules directory and uses them to setup the stream [3]. In this simple example, the testsource simply sends a single "hello" message, and the testsink outputs it using the logging framework.
$ processing module 'Module [name=testsink, type=sink]' from group 'example' with index: 1 $ processing module 'Module [name=testsource, type=source]' from group 'example' with index: 0 $ 16:11:50,542 WARN ThreadPoolTaskScheduler-1 handler.LoggingHandler:141 - hello
In the example above, we connected a source directly to a sink. It is also possible to interperse "processors" between the two. TODO: Example ??? Mark P. says use taps instead.
Home | About | Project | Getting Started | Technical Docs