I'm currently designing an application, and I'm confused at how to break apart my monolith application. After doing some research, service fabric actors seem to be the best solution for simple processing, but I'm confused at the approach I should take.
How my current application works in my monolith:
- IRC Message comes in from a user through a socket event.
- A processor parses the message, and locates the command (Using MEF) that should ultimately process the message. For example, if the command was '!help' it would locate the help command and send the message there. The processor also looks up user settings (For example, they can change the ! to a # in settings, and the processor would need to look for '#help' instead of '!help', and passes a massive settings object (as a context basically) to the command. I use something very similar to what JabbR does here.
If a command isn't found (ex !asdf).:
A. The channel has a default command set: the command is sent to that. (ex. !asdf isn't found, and they have help as the default command. The message is basically processed as !help asdf).
B. The channel doesn't have a default set: the message is ignored.
Message is processed through that command.
Ideally, I'd like each command to have its own service (They are separate units of work). Some thoughts on how I could design this via a microservice:
- Message comes in from a user and channel via a service bus topic.
- A processor parses the message, and fires an actor (With the actor ID being the channel ID associated with that message) which will then process the message. The processor would have to manage the list of services which are associated with each message, and this processor would need to be updated on each subsequent addition of a command service.
- Command Actor will manage it's state internally, which means settings will be internal to itself. An "ignore list" command, will manage it's own ignore list, and provide other processes the ability to view the ignore list. (In this case, the processor could/would use the ignore list to see if a user is ignored).
- Certain long running actors would become stateful services, and would manage their own settings for each channel that would access that service.
Another solution:
- Message comes in from a user via a service bus topic.
- A processor parses the message, and fires an actor (With the actor ID being the user ID associated with that message) which will then process the message. The processor would have to manage the list of services which are associated with each message, and this processor would need to be updated on each subsequent addition of a command service.
- Actor will call a user actor to manage and receive settings.
- Certain long running actors would become stateful services, and would manage their own settings for each user that would access that service.
A third solution:
- Message comes in from a user via a service bus topic.
- A processor parses the message, and puts a message onto a service bus queue. Using a SQL filter, each command would be a stateless service that could then attach on to the queue, and process messages that are associated with that command. A default command in this case would not be possible (Or I'd have to poll the list of subscribers on the queue, and get a list of rules they're all listening too, and compare each command against that list. It would require me to pull this list at a regular interval to ensure new services get added to this list.)
So to summarize, I'm having 2 issues: Where to handle settings for a user, and how to handle passing the commands off to either actors or services. How should I proceed?