Search code examples
c#serviceintegrationworker

Expanding C# Worker Service to work on multiple configs


For context, I have a c# worker service which is a very basic Twitter integration. It works off an XML config file with a connection string and search query parameters.

The service essentially searches for tweets with that search query, from the config, and stores into a SQL server database. (As I said, very basic!)

I am looking into the functionality of how to scale the code to run off multiple configs, each with different connection strings (same table structure, but different database). Each subsequent config would run a 'seperate' instance of the code and function together but independent.

I am not sure where to even start, and was just looking for someone pointing in the right direction of a way this could be done.

Thanks in advance :)


Solution

  • You should consider one main direction with two alternatives. To scale the process you need to implement the current code as an object or module. It should be called, factored or injected by an external handler along with the proper configuration. Now the alternatives. Depending on factors unknown to me, each separate instance could be implemented as an instance on the same thread or as a new thread or process.