This project contains the required bits necessary to run a Spring Cloud Dataflow demo that shows how easy it is to integrate the most exotic things together, for example Minecraft and a physical object such as Philips Hue lightbulbs.
This repository contains the following files of interest:
- link::minecraft-tcpevent-mod[
minecraft-tcpevent-mod/
] -
A minecraft Mod, using the the Minecraft Forge framework. This is a Gradle project and is meant to be built separately.
- link::hue-sink[
hue-sink/
] -
A Spring Boot App, leveraging Spring Cloud Stream annotations, so it can be used as a Dataflow sink. This app can interact with Philips Hue lightbulbs using the REST API exposed by a Philips Hue bridge
- link::map-sink[
map-sink/
] -
Another Boot sink app, but this time a GUI that displays moving entities in the Minecraft game by reacting to update events
- link::color-mixer-processor[
color-mixer-processor/
] -
A processor app that can work with color information (convert colorspaces, mix colors, etc).
- link::stream-application-rabbit-maven[
stream-application-rabbit-maven
] -
A convenience file used to register all out-of-the-box Dataflow applications as well as the
hue-sink
app and themap-sink
app contained in this project. HueEmulator-v0.7.jar
-
An emulator that can be used if you don’t have access to a real Philips Hue system.
Each Boot app is a standalone Maven project. The root of this repository also contains a parent pom.xml
file that
allows them to be built all at once. Hence,
minecraft-hue-dataflow $> ./mwnw clean install
should build everything you need.
Note
|
About shells
In these instructions, a prompt of On the other hand, a prompt of |
The Minecraft Mod relies on Minecraft Forge modding support. You can read more about Forge on its website, but to simply run the demo, you only need to
minecraft-hue-dataflow/minecraft-tcpevent-mod $> ./gradlew runClient
This will compile and package the mod and run a Minecraft Client with the mod already installed. You can configure the mod itself (for example choosing which type of events are emitted) by clicking on the "Mods" button.
In case you don’t have access to a real Hue system, you can still run these demos by using the Hue Emulator. The executable jar for version 0.7 is available in this repository, as well as a configuration script that registers the same user as the default in HueSinkProperties.java. To run:
minecraft-hue-dataflow $> sudo java -jar HueEmulator-v0.7.jar hue-config.json
Running with sudo
allows you to bind to port 80, which again is the default. You can of course choose another port and
later configure the hue-sink
app like so:
dataflow> stream create foo --definition "... | hue --port=8080" -deploy
Now that all the pieces are in place, it’s time to create and deploy streams with Dataflow. Let’s start by monitoring moving sheeps on the map:
dataflow> stream create herd --definition "tcp-client --port=8080 | map" --deploy
With the HUE emulator running on port 80, turn off the livingUpdates events in the minecraft mod and focus on laying down some colored wool blocks.
Then create a stream similar to the following:
dataflow> stream create colors --definition "tcp-client --port=8080 | hue" --deploy
The following stream allows one to see partitioning in action, using the x coordinate of the laid out block as a partitioning key (so that block in the same x row will go to the same lightbulb):
dataflow> stream create part --definition "tcp-client --port=8080 --outputType=text/plain | hue"
dataflow> stream deploy part --properties "app.hue.count=3,app.tcp-client.producer.partitionKey=payload.x