Last active
November 6, 2015 09:25
-
-
Save somdoron/666a6fcf59adb9835e37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Client | |
{ | |
/// <summary> | |
/// List of address to connect to. Will connect to the first one responding. Connected address can changed if disconnected. | |
/// </summary> | |
public void Connect(IEnumerable<string> addresses) | |
{ | |
} | |
public Task<byte[]> SendRequestAsync(string service, string subject, byte[] message) | |
{ | |
return null; | |
} | |
public Task SendOneWayAsync(string service, string subject, byte[] message) | |
{ | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IServerHandler | |
{ | |
Task<Message> HandleRequestAsync(string service, string subject, byte[] body); | |
void HandleOneWay(string service, string subject, byte[] body); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ISubscriberHandler | |
{ | |
void Handle(string stream, byte[] body); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Message | |
{ | |
public Message(string subject, byte[] body) | |
{ | |
Subject = subject; | |
Body = body; | |
} | |
public string Subject { get; private set; } | |
public byte[] Body { get; private set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Publisher | |
{ | |
public void Bind(string address, params object[] args) | |
{ | |
} | |
public void Publish(string stream, byte[] body) | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Server | |
{ | |
public Server(IServerHandler handler) | |
{ | |
} | |
/// <summary> | |
/// Bind the server to an address. Can be called multiple times. Address for clients only | |
/// </summary> | |
/// <param name="address"></param> | |
/// <param name="args"></param> | |
public void Bind(string address, params object[] args) | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Subscriber | |
{ | |
public Subscriber(ISubscriberHandler handler) | |
{ | |
} | |
/// <summary> | |
/// List of address to connect to. Will connect to the first one responding. Connected address can changed if disconnected. | |
/// </summary> | |
public void Connect(IEnumerable<string> addresses) | |
{ | |
} | |
public void Subscribe(string stream) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment