本文整理汇总了C#中MyMessage.SetHeader方法的典型用法代码示例。如果您正苦于以下问题:C# MyMessage.SetHeader方法的具体用法?C# MyMessage.SetHeader怎么用?C# MyMessage.SetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMessage
的用法示例。
在下文中一共展示了MyMessage.SetHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMessageHeader
void SetMessageHeader(IBus bus)
{
#region 3to4SetMessageHeader
MyMessage myMessage = new MyMessage();
myMessage.SetHeader("SendingMessage", "ValueSendingMessage");
bus.SendLocal(myMessage);
#endregion
}
示例2: Main
static void Main()
{
Console.Title = "Samples.Headers";
Configure configure = Configure.With();
configure.Log4Net();
configure.DefineEndpointName("Samples.Headers");
configure.DefaultBuilder();
configure.MsmqTransport();
configure.InMemorySagaPersister();
configure.RunTimeoutManagerWithInMemoryPersistence();
configure.InMemorySubscriptionStorage();
configure.JsonSerializer();
IConfigureComponents components = configure.Configurer;
components.ConfigureComponent<MutateIncomingMessages>(DependencyLifecycle.InstancePerCall);
components.ConfigureComponent<MutateIncomingTransportMessages>(DependencyLifecycle.InstancePerCall);
components.ConfigureComponent<MutateOutgoingMessages>(DependencyLifecycle.InstancePerCall);
components.ConfigureComponent<MutateOutgoingTransportMessages>(DependencyLifecycle.InstancePerCall);
components.ConfigureComponent<MessageMutator>(DependencyLifecycle.InstancePerCall);
components.ConfigureComponent<MutateTransportMessages>(DependencyLifecycle.InstancePerCall);
#region global-all-outgoing
using (IStartableBus startableBus = configure.UnicastBus().CreateBus())
{
IDictionary<string, string> outgoingHeaders = ((IBus) startableBus).OutgoingHeaders;
outgoingHeaders.Add("AllOutgoing", "ValueAllOutgoing");
#endregion
IBus bus = startableBus.Start(() => configure.ForInstallationOn<Windows>().Install());
#region sending
MyMessage myMessage = new MyMessage();
myMessage.SetHeader("SendingMessage", "ValueSendingMessage");
bus.SendLocal(myMessage);
#endregion
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}