I put way too much thought into this but I think I like it.
I wanted to build a good foundation here that will be testable and give us room to grow. The slack lib made this difficult.
Remove the GenStage framework - I still think there may be a use case for GenStage here but not directly in the slack message handling.
Isolate the Slack.Bot implementation as much as possible. It's hard to test.
Medera.Slack adapts Slack.Bot to our sane universe. It should be compatible with using some kind of worker pool in the future, too.
The TestConnector module should now only be used to catch messages that were sent back to slack. The way it was before, it would require a ton of double-implementation. This should be a lot simpler.
Medera.Slack.Handler.handle_event/1 is now the main business-logic entry point for a message coming from slack. If you're not concerned with the implementation of how we interact with slack, you shouldn't have to worry about any of the other Medera.Slack code!
Medera.Slack.Handler.handle_event/1 provides a mechanism for immediate replies, which should facilitate unit testing. There is still a mechanism for sending messages asynchronously (e.g., do some work, send a message to let the user know it's done) in Medera.Slack.send_message/2.
I may make some other tweaks but this is in the ballpark of where I wanted to end up.
I put way too much thought into this but I think I like it.
I wanted to build a good foundation here that will be testable and give us room to grow. The slack lib made this difficult.
Medera.Slack.Handler.handle_event/1
is now the main business-logic entry point for a message coming from slack. If you're not concerned with the implementation of how we interact with slack, you shouldn't have to worry about any of the other Medera.Slack code!Medera.Slack.Handler.handle_event/1
provides a mechanism for immediate replies, which should facilitate unit testing. There is still a mechanism for sending messages asynchronously (e.g., do some work, send a message to let the user know it's done) inMedera.Slack.send_message/2
.I may make some other tweaks but this is in the ballpark of where I wanted to end up.