Skip to content

Instantly share code, notes, and snippets.

@andreasohlund
Created November 8, 2010 21:23
Show Gist options
  • Save andreasohlund/668297 to your computer and use it in GitHub Desktop.
Save andreasohlund/668297 to your computer and use it in GitHub Desktop.
SSSBMessageForwarder
public class Forwarder: IWantToRunAtStartup
{
readonly IBus _bus;
readonly ITransport _transport;
public Forwarder(IBus bus, IYourOwnTransportFactory transportFactory)
{
_bus = bus;
_transport = transportFactory.GetTransport();
_transport.TransportMessageReceived += TransportMessageReceived;
}
void TransportMessageReceived(object sender, TransportMessageReceivedEventArgs e)
{
var message = e.Message.Body[0];
_bus.SendLocal(message);
}
public void Run()
{
_transport.Start();
}
public void Stop()
{
_transport.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment