📄 routercontroller.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace SSBExternalActivationRouter
{
class RouterController
{
Dictionary<string, ITransactedMessageMediator> _msgMediators = new Dictionary<string,ITransactedMessageMediator>();
Dictionary<string, ServiceMessageMapper> _msgMappers = new Dictionary<string,ServiceMessageMapper>();
RouterControllerSignal _signal = new RouterControllerSignal();
Thread _threadOperation;
public void Init()
{
_msgMediators.Add("TransactedMessageMediator_MSMQ", new TransactedMessageMediator_MSMQ());
_msgMediators.Add("TransactedMessageMediator_SQL2000", new TransactedMessageMediator_SQL2000());
_msgMappers.Add("MSMQ", new ServiceMessageMapper("MSMQ", _msgMediators["TransactedMessageMediator_MSMQ"], _signal));
_msgMappers.Add("SQL2000", new ServiceMessageMapper("SQL2000", _msgMediators["TransactedMessageMediator_SQL2000"], _signal));
}
public void Start(StartUpMode mode)
{
Init();
//Spin the mappers on a thread
switch (mode)
{
case StartUpMode.StartMSMQ:
_threadOperation = new Thread(_msgMappers["MSMQ"].Run);
_threadOperation.Start();
break;
case StartUpMode.StartSQL2000:
_threadOperation = new Thread(_msgMappers["SQL2000"].Run);
_threadOperation.Start();
break;
}
}
public void Stop()
{
_signal.ContinueProcessing = false;
}
}
enum StartUpMode
{
StartMSMQ,
StartSQL2000
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -