marceline icon indicating copy to clipboard operation
marceline copied to clipboard

some sort of macro for defining topologies

Open strongh opened this issue 11 years ago • 4 comments

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.

strongh avatar Oct 29 '13 19:10 strongh

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.

sorenmacbeth avatar Oct 29 '13 20:10 sorenmacbeth

I like that idea. Consistent with the current use of the * suffix as "stuff to be used inside macros".

strongh avatar Oct 29 '13 21:10 strongh

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.

strongh avatar Oct 30 '13 18:10 strongh

Also we probably want something related for streams, e.g. defstream, with-stream, etc.

strongh avatar Oct 31 '13 18:10 strongh