Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbulens/4c8d3964db21286214c9468b0712383f to your computer and use it in GitHub Desktop.
Save hbulens/4c8d3964db21286214c9468b0712383f to your computer and use it in GitHub Desktop.
using System;
using NServiceBus;
namespace hbulens.ServiceBus.Subscriber
{
class Program
{
static void Main(string[] args)
{
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("hbulens.ServiceBus.Subscriber"); busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit"); Console.ReadKey();
}
}
}
}
using System;
using NServiceBus;
using hbulens.ServiceBus.Messages;
namespace hbulens.ServiceBus.Subscriber
{
public class OrderCreatedHandler : IHandleMessages<OrderMessage>
{
void IHandleMessages<OrderMessage>.Handle(OrderMessage message)
{
Console.WriteLine(@"Handling: OrderPlaced for Order Id: {0}", message.Id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment