Skip to content

Instantly share code, notes, and snippets.

@mikedewar
Created November 14, 2015 18:27
Show Gist options
  • Save mikedewar/3364af352490239b496a to your computer and use it in GitHub Desktop.
Save mikedewar/3364af352490239b496a to your computer and use it in GitHub Desktop.
splitting
{"label":"splitting","blocks":[{"label":"","type":"get","id":2,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"key","value":{"data":"a"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":901,"y":393}},{"label":"","type":"delay","id":1,"inputs":[{"name":"in","value":{"data":{"a":1,"b":2}},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":692,"y":470}},{"label":"","type":"+","id":11,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":1},"type":"number"}],"outputs":[{"name":"x+y","type":"number"}],"source":null,"position":{"x":1031,"y":392}},{"label":"","type":"get","id":3,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"key","value":{"data":"b"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":1193,"y":578}},{"label":"","type":"merge","id":6,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"in","value":null,"type":"object"}],"outputs":[{"name":"out","type":"object"}],"source":null,"position":{"x":1392,"y":452}},{"label":"","type":"set","id":9,"inputs":[{"name":"key","value":{"data":"A"},"type":"string"},{"name":"value","value":null,"type":"any"}],"outputs":[{"name":"object","type":"object"}],"source":null,"position":{"x":1165,"y":376}},{"label":"","type":"set","id":10,"inputs":[{"name":"key","value":{"data":"B"},"type":"string"},{"name":"value","value":null,"type":"any"}],"outputs":[{"name":"object","type":"object"}],"source":null,"position":{"x":1353,"y":566}},{"label":"","type":"merge","id":7,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"in","value":null,"type":"object"}],"outputs":[{"name":"out","type":"object"}],"source":null,"position":{"x":1541,"y":500}},{"label":"","type":"log","id":18,"inputs":[{"name":"log","value":null,"type":"any"}],"outputs":[],"source":null,"position":{"x":1717,"y":499}}],"connections":[{"from":{"id":1,"route":0},"to":{"id":2,"route":0},"id":4},{"from":{"id":2,"route":0},"to":{"id":11,"route":0},"id":12},{"from":{"id":3,"route":0},"to":{"id":10,"route":1},"id":14},{"from":{"id":10,"route":0},"to":{"id":7,"route":1},"id":15},{"from":{"id":9,"route":0},"to":{"id":6,"route":0},"id":16},{"from":{"id":1,"route":0},"to":{"id":3,"route":0},"id":5},{"from":{"id":1,"route":0},"to":{"id":6,"route":1},"id":8},{"from":{"id":11,"route":0},"to":{"id":9,"route":1},"id":13},{"from":{"id":6,"route":0},"to":{"id":7,"route":0},"id":17},{"from":{"id":7,"route":0},"to":{"id":18,"route":0},"id":19}],"groups":[{"id":20,"label":"splitting","children":[2,1,11,3,6,9,10,7,18],"position":{"x":1221,"y":470}}],"sources":[],"links":[]}
@mikedewar
Copy link
Author

image

@mikedewar
Copy link
Author

This simple example shows an object being broken up into parts, operated on in paths of different lengths, and then being re-joined and logged. Due to the grammar of streamtools the shorter paths are blocked until the longer paths are satisfied, allowing you to safely split and merge messages in complex patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment