Skip to content

Instantly share code, notes, and snippets.

@push-gists
Last active August 2, 2016 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save push-gists/d054ec077c1a9e71acb4378e0b22db04 to your computer and use it in GitHub Desktop.
Save push-gists/d054ec077c1a9e71acb4378e0b22db04 to your computer and use it in GitHub Desktop.
Add a generic transformed stream by using a StreamBuilder
StreamBuilders.newBinaryStreamBuilder()
.transform(Bytes::toByteArray)
.transform(String::new)
.create(
session.feature(Topics.class),
"binary/data",
new TransformedStream.Default<Binary, String>() {
@Override
public void onValue(
String topicPath,
TopicSpecification specification,
String oldValue,
String newValue) {
// Do something awesome
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment