Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class EndpointConfig : IConfigureThisEndpoint
{
public void Customize(BusConfiguration busConfiguration)
{
var container = new UnityContainer();
busConfiguration.UseTransport<MsmqTransport>();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.UseContainer<UnityBuilder>(
customizations: customizations =>
{
customizations.UseExistingContainer(container);
});
}
}
public class Sender : IWantToRunWhenBusStartsAndStops
{
public IBus Bus { get; set; }
public void Start()
{
Bus.SendLocal(new MyMessage());
Bus.SendLocal(new MyMessage());
Bus.SendLocal(new MyMessage());
}
public void Stop()
{
}
}
public class MyMessage : IMessage
{
}
public class MyMessageHandler : IHandleMessages<MyMessage>
{
public void Handle(MyMessage message)
{
Console.WriteLine("Got message");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment