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"); }
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(); }