Why is it better not to install two or more instances of TargetProcess on the same machine?
The reason is TargetProcess communicates with Plugins using MSMQ. TargetProcess has input queue, and Plugins send commands to this queue. The name of the queue is Tp.InputCommand by default and it can be configured in the web.config. So if two instances of TargetProcess are installed on the same mashine, both will listen to Tp.InputCommand by default. And when plugin sends command (i.e. message with PluginInfo, when plugin is started) to tp.inputqueue, only one of TargetProcess instances will receive this message (randomly). And only one TargetProcess will show this plugin in the plugin list.
Moreover each plugin is installed as a windows service. Service name should be unique. So you will fail to install two instances of the same plugin within default installation.
To configure two separate instances of TargetProcess, which can work properly with its own plugin version, you need to do the following:
- Install the first instance TargetProcess.
- Install a second instance TargetProcess from archive without plugins.
- Go to web.config of the 2-nd TargetProcess. Change input queue to some another value (i.e. tp.inputcommand1)
<MsmqTransportConfig InputQueue="Tp.InputCommand" ErrorQueue="Tp.Error" NumberOfWorkerThreads="1" MaxRetries="5" />
- Go to 'Plugins' folder of the 2-nd TargetProcess.
- Go to each plugin folder and do the following :
- go to pluginsettings.config and change TargetProcessInputQueue setting value to another (i.e. tp.inputcommand1)
<setting name="TargetProcessInputQueue" serializeAs="String"> <value>Tp.InputCommand1</value> </setting>
- change pluginDatabaseConnectionString to the database you use for the 2nd TargetProcess.
- change PluginInputQueue setting to another value (i.e. Tp.PopEmailIntegration1 in case of email plugin)
<setting name="PluginInputQueue" serializeAs="String"> <value>Tp.PopEmailIntegration1</value> </setting>
- go to install.bat file. Change service name to another value (i.e. TPPopEmailIntegration1 in case of email plugin)
- go to pluginsettings.config and change TargetProcessInputQueue setting value to another (i.e. tp.inputcommand1)
And run the following command with changed service name in console:
NServiceBus.Host.exe /install Tp.Integration.Plugin.Common.TpPluginProfile /serviceName:TPPopEmailIntegration1 /displayName:"TP POP Email Integration1" /description:"Synchronizes emails from specified email account to TP" net start TPPopEmailIntegration1
That’s all. Now you have two instances of TargetProcess with their own plugins. And each instance is able to send commands to its own TargetProcess queue. And vice versa, each TargetProcess listens to its own input queue. So there is no intersection.