本文整理汇总了C#中IBus.Send方法的典型用法代码示例。如果您正苦于以下问题:C# IBus.Send方法的具体用法?C# IBus.Send怎么用?C# IBus.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBus
的用法示例。
在下文中一共展示了IBus.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartSaga
private static void StartSaga(IBus bus, int iterasjoner = 1)
{
const string Tekst = "en veldig lang tekst skal dette bli og det er ingen grenser for hvor frekk den kan være";
var tekstHash = Tekst.GetHashCode();
var ordListe = Tekst.Split(new[] { ' ' });
for (var i = 0; i < iterasjoner; i++)
{
var sagaId = Guid.NewGuid();
Console.Out.WriteLine(@"KLIENT: Starter saga med id '{0}'.", sagaId);
bus.Send("Server", new TekstSagaStartMelding
{
SagaId = sagaId,
TekstHash = tekstHash
});
for (var ordTeller = 0; ordTeller < ordListe.Count(); ordTeller++)
{
bus.Send("Server", new TekstSagaFragment
{
SagaId = sagaId,
FragmentId = ordTeller,
Fragment = ordListe[ordTeller]
});
}
}
}
示例2: SendMessages
public override async Task SendMessages(IBus bus, Func<bool> shouldKeepSending)
{
while (shouldKeepSending())
{
await bus.Send(new FooCommand());
await bus.Send(new BarCommand());
await bus.Send(new BazCommand());
await bus.Send(new QuxCommand());
IncrementExpectedMessageCount(4);
}
}
示例3: SendMessages
public override IEnumerable<Task> SendMessages(IBus bus)
{
for (var i = 0; i < NumMessagesToSend/4; i++)
{
yield return bus.Send(new FooCommand());
yield return bus.Send(new BarCommand());
yield return bus.Send(new BazCommand());
yield return bus.Send(new QuxCommand());
Console.Write(".");
}
Console.WriteLine();
}
示例4: RelocateCustomer
private static void RelocateCustomer(IBus bus, Guid aggregateId)
{
bus.Send(new RelocatingCustomerCommand(aggregateId, "Messestraße", "2", "4444", "Linz"));
Console.WriteLine("Customer relocated. Press any key to show list of customers.");
Console.ReadLine();
}
示例5: OnStart
protected override void OnStart(string[] args)
{
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("SendNsbMessage");
busConfiguration.UseSerialization<XmlSerializer>();
if (Environment.UserInteractive && Debugger.IsAttached)
{
//TODO: For production use, please select a durable persistence.
busConfiguration.UsePersistence<InMemoryPersistence>();
//TODO: For production use, please script your installation.
busConfiguration.EnableInstallers();
busConfiguration.Conventions()
.DefiningCommandsAs(t => t.Namespace != null && t.Namespace == "IntegrationSample.Messages.Commands");
busConfiguration.Conventions()
.DefiningEventsAs(t => t.Namespace != null && t.Namespace == "IntegrationSample.Messages.Events");
}
var startableBus = Bus.Create(busConfiguration);
bus = startableBus.Start();
Console.WriteLine("\r\nPress '1' to send an NSB message\r\n");
while (true)
{
var key = Console.ReadKey(true);
if (key.KeyChar == '1')
bus.Send(new ProcessOrder()
{
OrderId = Guid.NewGuid(),
});
Console.WriteLine("\r\nPress '1' to send an NSB message\r\n");
}
}
示例6: SendOrder
static void SendOrder(IBus bus)
{
Console.WriteLine("Press enter to send a message");
Console.WriteLine("Press any key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
if (key.Key != ConsoleKey.Enter)
{
return;
}
Guid id = Guid.NewGuid();
PlaceOrder placeOrder = new PlaceOrder
{
Product = "New shoes",
Id = id
};
bus.Send("Samples.StepByStep.Server", placeOrder);
Console.WriteLine("Sent a new PlaceOrder message with id: {0}", id.ToString("N"));
}
}
示例7: SendOrder
static void SendOrder(IBus bus)
{
Console.Title = "Client";
Console.Clear();
Console.WriteLine("Press enter to send a message");
Console.WriteLine("Press any key to exit");
int caseId = 101;
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
if (key.Key != ConsoleKey.Enter)
{
return;
}
PlaceOrderCommand placeOrder = new PlaceOrderCommand
{
SagaId = Guid.NewGuid(),
CaseId = caseId++
};
bus.Send(placeOrder);
Console.WriteLine("Sent a new PlaceOrder message for CaseId:{0} with UniqueId: {1}", placeOrder.CaseId, placeOrder.SagaId.ToString("N"));
}
}
示例8: OnSucceeded
public void OnSucceeded(IBus bus, IMessageInformation info)
{
if (info.MessageType != typeof(MessageInformation))
{
bus.Send(Convert(info));
}
}
示例9: OnBusStarted
public void OnBusStarted(IBusConfiguration config, IBus bus)
{
if (config.IsConsoleMode)
{
Task.Factory.StartNew(() =>
{
// uncomment to send lots of messages
//for (int i = 0; i < 1000; i++)
{
bus.Send<GetCustomersCommand>();
bus.Send<GetInvoicesCommand>();
bus.Send<GetProductsCommand>();
}
});
}
}
示例10: Expiration
// Shut down server before sending this message, after 30 seconds, the message will be moved to Transactional dead-letter messages queue.
static void Expiration(IBus bus)
{
bus.Send("Samples.Unobtrusive.Server", new MessageThatExpires
{
RequestId = new Guid()
});
Console.WriteLine("message with expiration was sent");
}
示例11: Expiration
// Shut down server before sending this message, after 30 seconds, the message will be moved to Transactional dead-letter messages queue.
static void Expiration(IBus bus)
{
bus.Send(new MessageThatExpires
{
RequestId = new Guid()
});
Console.WriteLine("message with expiration was sent");
}
示例12: Usage
Usage(IBus bus)
{
#region custom-correlationid
bus.Send("TargetQueue", "My custom correlation id", new MyRequest());
#endregion
}
示例13: Usage
Usage(IBus bus)
{
#region RequestImmediateDispatchUsingScope
using (new TransactionScope(TransactionScopeOption.Suppress))
{
bus.Send(new MyMessage());
}
#endregion
}
示例14: SendJsonMessage
static void SendJsonMessage(IBus bus)
{
MessageWithJson message = new MessageWithJson
{
SomeProperty = "Some content in a json message",
};
bus.Send("Samples.MultiSerializer.Receiver", message);
Console.WriteLine("Json Message sent");
}
示例15: SendBinaryMessage
static void SendBinaryMessage(IBus bus)
{
MessageWithBinary message = new MessageWithBinary
{
SomeProperty = "Some content in a binary message",
};
bus.Send("Sample.MultiSerializer.Receiver", message);
Console.WriteLine("Binary message sent");
}