marceline
marceline copied to clipboard
some sort of macro for defining topologies
Most build-topology
(or equivalent) functions look very similar. In simple cases something like a macro for
(doto (TridentTopology.)
(t/new-stream "my-spout" spout)
...))
could almost work. But for even marginally more complicated topologies, there might be states or intermediate streams that need to be defined.
Another option would be to have a with-trident-topology
macro that bound e.g. *trident-topology*
to a TridentTopology
object, and returned the trident topology at the end. We'd have to change all the arities of the existing helpers, and they would no longer be useful outside of a with-trident-topology
. I think that's fine.
One way to deal with the arity issue would be to make the functions suffixed by * again, then have macro version without the * for use in the with-trident-topology macro.
I like that idea. Consistent with the current use of the *
suffix as "stuff to be used inside macros".
Another possibility is to have a deftridenttopology
which would replace build-topology
fns. The question there is what the signature should be - a seq of spouts, a seq of state factories, and a drpc, all optional? This wouldn't exclude with-trident-topology
, it would probably use it. Basically deftridenttopology
would just wrap with-trident-topology
with a standard signature.
Also we probably want something related for streams, e.g. defstream
, with-stream
, etc.