This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NServiceBus; | |
using hbulens.ServiceBus.Messages; | |
namespace hbulens.ServiceBus.Publisher | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
BusConfiguration busConfiguration = new BusConfiguration(); | |
busConfiguration.EndpointName("hbulens.ServiceBus.Publisher"); | |
busConfiguration.UseSerialization < JsonSerializer > (); | |
busConfiguration.UsePersistence < InMemoryPersistence > (); | |
busConfiguration.EnableInstallers(); | |
using(IBus bus = Bus.Create(busConfiguration).Start()) | |
{ | |
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) | |
{ | |
break; | |
} | |
OrderMessage placeOrder = new OrderMessage | |
{ | |
Description = "TEST", Id = Guid.NewGuid() | |
}; | |
bus.Publish(placeOrder); | |
Console.WriteLine("Sent a new message with id: {0}", placeOrder.Id.ToString()); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment