My team is currently developing an application using a microservice architecture with publish/subscribe interservice communication over a message bus. Certain types of HTTP requests and messages received as inputs to a service might cause that service to subsequently publish certain types of messages as a result in addition to the HTTP response if there was an HTTP request, and these published messages might trigger publication events from other services as well. I'd like to be able to programmatically generate a chart of all of the possible message flows without having to run any of these services.
Our backend services are currently developed in Kotlin and Ruby. In Kotlin, our messages are statically typed, and I believe it should be possible to programatically determine message flow inputs and outputs from each Kotlin service at compile time or through static code analysis.
How should I start to tackle this problem? I'm focusing on the Kotlin services first, as that's where I have the most experience. I'm trying to determine if the Arrow functional programming library can encode potential message output side effects (of specific message types) at the type level, but I'm not sure if that's possible. I'm also considering using static code analysis provided by an external program or programs rather than using the Kotlin compiler and type system, which seems more likely to bear fruit but also more involved.