本文整理汇总了C#中MessagePayload类的典型用法代码示例。如果您正苦于以下问题:C# MessagePayload类的具体用法?C# MessagePayload怎么用?C# MessagePayload使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessagePayload类属于命名空间,在下文中一共展示了MessagePayload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_support_delivery
public void Should_support_delivery()
{
Vane<Message> vane = VaneFactory.New<Message>(x =>
{
x.Consumer(() => new TestConsumer(), xc =>
{
xc.Consume<A>(c => c.Consume);
xc.Consume<B>(c => c.Consume);
});
});
var a = new A {Value = "Hello"};
Payload<Message> payload = new MessagePayload<A>(a);
vane.Execute(payload, CancellationToken.None);
var b = new B {Value = "World"};
payload = new MessagePayload<B>(b);
vane.Execute(payload, CancellationToken.None);
var visitor = new StringVaneVisitor();
visitor.Visit(vane);
Console.WriteLine(visitor.ToString());
}
示例2: ReceiveAcknowledgementFor
public void ReceiveAcknowledgementFor(MessagePayload messagePayload)
{
ReceiveMessage(
new MessagePayload()
.AsAcknowlegement(messagePayload.GetPersistenceId())
.SetToChannel(messagePayload.GetFromAddress().Channel));
}
示例3: InputMessage
public override void InputMessage(MessagePayload toInput)
{
if(!toInput.HasBody()) return;
if(toInput.GetToAddress() != address) return;
OnMessageProcessed(toInput);
}
示例4: PersistMessage
void PersistMessage(MessagePayload toInput)
{
Logger.Debug("Caching message payload {0}", toInput.Id);
toInput.SetPersistenceId(messageCache.Address, messageCache.UseType);
messageCache.AddMessageAndIncrementSequence(toInput);
}
示例5: PerformLogging
void PerformLogging(MessagePayload toInput)
{
Logger.Debug(
"Attaching session {0} for message: {0}",
cache.GetCurrentSessionFor(GetServer()).Id,
toInput.Id);
}
示例6: HandleMessage
public void HandleMessage(MessagePayload toHandle, List<MessagePayload> outgoingMessages)
{
if (!toHandle.IsLongPollRequest())
return;
outgoingMessages.AddRange(outgoingQueue.DequeueAll(toHandle.GetLongPollRequestServerPath()));
}
示例7: InputMessage
public override void InputMessage(MessagePayload toInput)
{
Logger.Debug("Recording message persistence source on payload {0}", toInput.Id);
toInput.SetSourcePersistenceId(toInput.GetPersistenceId());
OnMessageProcessed(toInput);
}
示例8: LogWithAddress
static void LogWithAddress(MessagePayload toHandle)
{
Logger.Debug("Handling sent message {0} for {1} from {2}",
toHandle.Id,
toHandle.GetToAddress().Channel,
toHandle.GetToAddress().Server.Address);
}
示例9: CreateLongPollPayload
MessagePayload CreateLongPollPayload(MessageServer toListenFor)
{
var payload = new MessagePayload();
payload.SetLongPollRequest(toListenFor);
return payload;
}
示例10: CacheMessage
void CacheMessage(MessagePayload toInput)
{
if(messageCache.ContainsMessage(toInput))
messageCache.UpdateMessage(toInput);
else
messageCache.AddMessage(toInput);
}
示例11: InputMessage
public override void InputMessage(MessagePayload toInput)
{
Logger.Debug("Recording the last time sent on message payload {0}", toInput.Id);
SetTimeOnMessage(toInput);
OnMessageProcessed(toInput);
}
示例12: InputMessage
public override void InputMessage(MessagePayload toInput)
{
if (messageCache.ResetOn < toInput.GetSequenceOriginSetOn())
messageCache.Reset(toInput.GetFirstSequence(), toInput.GetSequenceOriginSetOn());
OnMessageProcessed(toInput);
}
示例13: InputMessage
public override void InputMessage(MessagePayload toInput)
{
SetCurentSenderAddress(toInput);
SetCurrentReceiverAddress(toInput);
SetCurrentCorrelationId(toInput);
OnMessageProcessed(toInput);
}
示例14: InputMessage
public override void InputMessage(MessagePayload toInput)
{
Logger.Debug("Addressing message payload {0} to {1}", toInput.Id, toAddress);
toInput.SetFromAddress(fromAddress);
toInput.SetToAddress(toAddress);
OnMessageProcessed(toInput);
}
示例15: Enqueue
public void Enqueue(MessagePayload toEnqueue)
{
Contract.Requires(toEnqueue != null);
CreateQueueIfNonExistant(toEnqueue.GetToAddress().Server);
queues[toEnqueue.GetToAddress().Server].Enqueue(toEnqueue);
}