📄 ssbconversationmediator.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Transactions;
namespace SSBExternalActivationRouter
{
class SSBConversationMediator
{
ITransactedMessageMediator _mediator;
ServiceMessageMapperSignal _signal;
SSBConversation _conv = new SSBConversation();
public SSBConversationMediator(ITransactedMessageMediator med, ServiceMessageMapperSignal signal)
{
_mediator = med;
_signal = signal;
}
public void OpenChannels(string source, object destination)
{
_conv.Init(source);
_mediator.Init(destination);
}
public void Process()
{
TransactionScope ReadMsgScope;
while (IsConversationToProcess() && _signal.ContinueProcessing)
{
ReadMsgScope = new TransactionScope();
//Begin transaction
using (ReadMsgScope)
{
_conv.ReadMessage();
if (_conv.IsTermMessage())
{
//Do nothing commit tran and move on
}
else
{
_mediator.Translate(_conv.CurrentMessage);
}
//Commits the changes
ReadMsgScope.Complete();
}
}
}
public bool IsConversationToProcess()
{
return (_conv.AreThereMessages());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -