Skip to content

Instantly share code, notes, and snippets.

@mikeminutillo
Created February 14, 2017 09:11
Show Gist options
  • Save mikeminutillo/d5706c68578b936dc6ffb7c588154211 to your computer and use it in GitHub Desktop.
Save mikeminutillo/d5706c68578b936dc6ffb7c588154211 to your computer and use it in GitHub Desktop.
Nsb V5 satellite that just repeats what it gets sent
class EchoSatellite : ISatellite
{
public bool Handle(TransportMessage message)
{
string replyToAddress;
if (message.Headers.TryGetValue(Headers.ReplyToAddress, out replyToAddress))
{
dispatcher.Send(message, new SendOptions(replyToAddress));
return true;
}
return false;
}
public void Start() { }
public void Stop() { }
public Address InputAddress => settings.LocalAddress().SubScope("echo");
public bool Disabled => false;
private readonly ISendMessages dispatcher;
private readonly ReadOnlySettings settings;
public EchoSatellite(ISendMessages dispatcher, ReadOnlySettings settings)
{
this.dispatcher = dispatcher;
this.settings = settings;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment