@tolitius is there another way to implement this and avoid duplication of the start and stop fn everywhere? As far as I understand the defstate macro, it must be executed inside the ns, not in a function, because that would create that state local to that function (wrong scope).
@f.v.claus > is there another way to implement this and avoid duplication of the start and stop fn everywhere? can you elaborate of what it is you are trying to achieve? i.e. why would you have/need this duplication in the first place?
@tolitius the macro above creates a state that handles a connection. The channel name and notify fns are different. Implementing one state instead of several require more development and testing effort than I am willing to invest right now.
you mean you need to create several connections, one of each channel?
depending on what it is you are doing if all of these connections created at the same time (when the app starts) and stop at the same time (when the app ends), you could have a function that takes all these channel names and creates all the connections at once, which could then be used as a :start
function of a single state
or you could have a connection pool
like state that issues and releases connections