Created
March 12, 2015 10:59
-
-
Save ersiny/a3ada6ea84aeb88491b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream<MessageAndMetadata<byte[], byte[]>> stream = StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false); | |
while (true) { | |
stream.parallel().map(d -> { | |
byte[] value = d.message(); | |
Message msg = message.newBuilderForType().mergeFrom(value, 0, value.length).build(); | |
return 1; // I would actuall extract a field from the message and return it, keeping it simple here | |
}).sum(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment