Travesty
Diagram- and graph-generating library for Akka Streams
Install / Use
/learn @mikolak-net/TravestyREADME
= Travesty :repoBaseUrl: https://github.com/mikolak-net/travesty :fileBrowseBaseUrl: {repoBaseUrl}/blob/master/ :issueBaseUrl: {repoBaseUrl}/issues/ :toc: :icons: font
image:https://travis-ci.org/mikolak-net/travesty.svg?branch=master["Build Status", link="https://travis-ci.org/mikolak-net/travesty"]image:https://maven-badges.herokuapp.com/maven-central/net.mikolak/travesty_2.13/badge.svg["Latest 2.13 version", link="https://maven-badges.herokuapp.com/maven-central/net.mikolak/travesty_2.13"] image:https://maven-badges.herokuapp.com/maven-central/net.mikolak/travesty_2.12/badge.svg["Latest 2.12 version", link="https://maven-badges.herokuapp.com/maven-central/net.mikolak/travesty_2.12"]
== What is it?
Travesty is a utility library for Akka Streams. It has two uses:
- generating structural diagrams of your Akka Streams, both as graphics and text (the latter useful for logging). Example:
image::doc/example_graph.svg[]
- generating https://tinkerpop.apache.org/[Tinkerpop 3 / Gremlin^] graph data structures - usable for e.g. writing tests that check stage sequencing in dynamically constructed Streams.
== What's new?
=== 0.9.2
- Switched to Scala 2.13 and updated dependencies (also relased support for 2.6.10 to 2.6.14 for Scala 2.12, as 0.9.1)
=== 0.9.1
- Fixed issue with graph not generating when some of the stages have no names (thanks to @FXHibon for the fix).
=== 0.9
- Added support for partial graphs (see below for example),
- Added support for Akka 2.5.10-11.
=== 0.8
- Added "manual support" for typed diagrams/graphs (see link:#typed-diagrams[Typed diagrams]),
- made Graphviz engine selection configurable for better speed/compatibility ({issueBaseUrl}3[#3^]),
- fixed {issueBaseUrl}4[#4^],
- extended Akka version support up to 2.5.9 .
== How to use it
=== Include in your project
Add to your build.sbt
[source,scala]
//repo of dependency used for text rendering resolvers += "indvd00m-github-repo" at "https://raw.githubusercontent.com/indvd00m/maven-repo/master/repository"
"net.mikolak" %% "travesty" % "0.9_AKKAVERSION" //for example "net.mikolak" %% "travesty" % "0.9_2.5.11"
Where AKKAVERSION is the version of Akka (Streams) you're using in your project. Currently supported
are versions 2.5.[4-11], and Scala 2.12.
You can review all available versions on link:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22net.mikolak%22%20AND%20a%3A%22travesty_2.12%22[Maven Central^].
=== Diagram generation
[source,scala]
import net.mikolak.travesty import net.mikolak.travesty.OutputFormat
val graph = ??? //your graph here
//render as image to file, PNG is supported as well travesty.toFile(graph, OutputFormat.SVG)("/tmp/stream.svg")
//render as text "image" log.info(travesty.toString(graph)) //take care NOT to wrap the text
==== Example text output
Here's how a typical travesty.toString(graph) may look like:
[source]
********* *******
**** **** ** **
* *
*INLET* * seqSink *
* *
**** **** ●●● ** **
********* ●●● ●● ●● *******
●●●●● ●● ●●
●●●●●● ● ●●●●● ●
●●●●● ********* ********* ●●●●●
●●●● **** **** *** *** ●●●
* * ●● * *
ZipWith2 ●●●●●●●●● ●● * broadcast *
* * ●● * *
**** **** ● *** ***
●●●● ********* ********* ●●
●●●●●●●●●● ●●●● ●
●●●● ● ●●●●● ●●
************* ●● ●●●●●● *************
******************* ●● ******* *******
** ** * *
singleSource * *OUTLET* *
** ** * *
******************* ******* *******
************* *************
Flow[String,String,akka.NotUsed]
And here's the same example in a vertical orientation, i.e. travesty.toString(graph, direction = BottomToTop):
[source]
************* *********
******************* **** ****
** ** * *
singleSource *INLET*
** ** * *
******************* **** ****
************* *********
● ●
● ●
● ●
● ●
● ●
● ●
● ●
