- python3
- pip
- docker
Install required libraries:
$ pip install asab bspump
Clone git repository to your work directory:
$ git clone git@github.com:LibertyAces/BitSwanPump-BlankApp.git bspump-blank-app
Move to the directory (it is bspump-blank-app
in our case):
$ cd bspump-blank-app
Then you can build your docker image:
$ docker build -t bspump-blank-app .
Once you have your docker image built, run it in a container:
$ sudo docker run -p 8888:8888 -p 8080:8080 bspump-blank-app
We use port 8888 for TCP Sink and 8080 for web handler in sample pipeline.
In new terminal use netCat to connect to TCPSink:
nc -v localhost 8888
Now write any message, "test" for example. You should see your message enriched in docker container stderr
.
Or you can try it out using http endpoint. Just call
http://localhost:8080/blank?message=test
From here you should have your BSPump application up and running. You may go on and customize it to your needs. Basic pipline structure is defined in pipeline init:
self.build(
bspump.socket.TCPSource(app, self, config={"host": "0.0.0.0", "port": 8888}),
ShakespeareanEnricher(app, self),
bspump.common.PPrintSink(app, self, stream=sys.stderr)
)
You can see the TCPSource
at the beginning, followed by any number of processors, ending with sink. To customize the pipline simply replace any part of it by your own alternative.
You can find more information about available sources, sinks and processors at https://github.com/LibertyAces/BitSwanPump