public void Start() { var registry = new ExtensionRegistry(); //registry.AddRequiredExtension(new JsonExtension()); if (MessagesPerAck == 1) { registry.AddRequiredExtension(new SingleAckExtension()); } else if (MessagesPerAck != 0) { registry.AddRequiredExtension(new BatchAckExtension { MessagesPerAck = MessagesPerAck, MaxAmountOfPendingMessages = 1000000, AckExpireTime = TimeSpan.FromSeconds(120) // as we queue up msgs a lot faster than they can be sent. }); } registry.AddRequiredExtension(new DotNetTypeExtension()); var parts = RemoteHost.Split(':'); var port = int.Parse(parts[1]); _client = new SharpMessagingClient("TestClient", registry); _client.Start(parts[0], port); _client.FrameReceived = OnTimingFrame; //start timing var buffer = Encoding.ASCII.GetBytes(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.ffff")); _client.Send(new MessageFrame(buffer)); Console.WriteLine("All enqueued"); }
private void Benchmark(SharpMessagingClient client) { var buffer = MessageSize < 12 ? Encoding.ASCII.GetBytes("1".PadLeft(MessageSize, '0')) : Encoding.ASCII.GetBytes("\"hello world ".PadRight(9999) + "\""); var payload = new ArraySegment <byte>(buffer); Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " Starting"); for (var i = 1; i < MessageCount; i++) { var frame = new MessageFrame { PayloadBuffer = payload }; client.Send(frame); } // packet to mark the end. client.Send(new MessageFrame { PayloadBuffer = new ArraySegment <byte>(new[] { (byte)'"', (byte)'m', (byte)'o', (byte)'t', (byte)'h', (byte)'e', (byte)'r', (byte)'"' }) }); }
public void Start() { var registry = new ExtensionRegistry(); //registry.AddRequiredExtension(new JsonExtension()); if (MessagesPerAck != 0) { registry.AddRequiredExtension(new AckExtension { MessagesPerAck = MessagesPerAck, AckExpireTime = TimeSpan.FromSeconds(120) // as we queue up msgs a lot faster than they can be sent. }); } registry.AddRequiredExtension(new DotNetTypeExtension()); var parts = RemoteHost.Split(':'); var port = int.Parse(parts[1]); _client = new SharpMessagingClient("TestClient", registry); _client.Start(parts[0], port); _client.FrameReceived = OnTimingFrame; //start timing var buffer = Encoding.ASCII.GetBytes(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.ffff")); _client.Send(new MessageFrame(buffer)); Console.WriteLine("All enqueued"); }
public static void CreateClient() { var client = new SharpMessagingClient(); client.Start("localhost", 8334); client.Send(new MessageFrame(Encoding.ASCII.GetBytes("hello"))); Console.WriteLine("Sent!"); Console.ReadLine(); }
public static void CreateClient() { var registry = new ExtensionRegistry(); registry.AddRequiredExtension(new AckExtension() { MessagesPerAck = 10, AckExpireTime = TimeSpan.FromSeconds(1) }); //registry.AddRequiredExtension(new FastJsonExtension()); var client = new SharpMessagingClient("MyClient", registry); client.Start("localhost", 8334); client.Send(new MessageFrame("Hello")); Console.WriteLine("Sent!"); Console.ReadLine(); }
public static void CreateClient() { var registry = new ExtensionRegistry(); registry.AddRequiredExtension(new AckExtension() { MessagesPerAck = 10, AckExpireTime = TimeSpan.FromSeconds(1) }); //registry.AddRequiredExtension(new FastJsonExtension()); var client = new SharpMessagingClient("MyClient", registry); client.Start("localhost", 8334); client.Send(new MessageFrame("Hello")); Console.WriteLine("Sent!"); Console.ReadLine(); }
private void Benchmark(SharpMessagingClient client) { var buffer = MessageSize < 12 ? Encoding.ASCII.GetBytes("1".PadLeft(MessageSize, '0')) : Encoding.ASCII.GetBytes("\"hello world ".PadRight(9999) + "\""); var payload = new ArraySegment<byte>(buffer); Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " Starting"); for (var i = 1; i < MessageCount; i++) { var frame = new MessageFrame { PayloadBuffer = payload }; client.Send(frame); } // packet to mark the end. client.Send(new MessageFrame { PayloadBuffer = new ArraySegment<byte>(new[] {(byte) '"', (byte) 'm', (byte) 'o', (byte) 't', (byte) 'h', (byte) 'e', (byte) 'r', (byte) '"'}) }); }