Skip to content

Instantly share code, notes, and snippets.

@SzymonPobiega
Created November 3, 2016 08:18
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 SzymonPobiega/10be5a9356b8cc203fceda2e114980db to your computer and use it in GitHub Desktop.
Save SzymonPobiega/10be5a9356b8cc203fceda2e114980db to your computer and use it in GitHub Desktop.
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