/// <summary> /// Uses Twino.MQ Messaging Queue server /// </summary> public static TwinoServer UseMqServer(this TwinoServer server, MqServer mqServer) { MqConnectionHandler handler = new MqConnectionHandler(mqServer); mqServer.Server = server; server.UseTmq(handler); return(server); }
/// <summary> /// Uses Twino.MQ Messaging Queue server /// </summary> public static TwinoServer UseMqServer(this TwinoServer server, MqServer mqServer) { MqConnectionHandler handler = new MqConnectionHandler(mqServer); mqServer.Server = server; mqServer.NodeServer.ConnectionHandler = new NodeConnectionHandler(mqServer.NodeServer, handler); server.UseTmq(handler); if (mqServer.NodeServer != null) { mqServer.NodeServer.SubscribeStartStop(server); } return(server); }
static void Main(string[] args) { TwinoServer server = new TwinoServer(ServerOptions.CreateDefault()); server.UseTmq(async(socket, msg) => { Console.WriteLine(msg); await Task.CompletedTask; }); server.Start(82); TmqClient client = new TmqClient(); client.Data.Properties.Add("Host", "localhost"); client.ClientId = "123"; client.Connect("tmq://localhost:82/sample"); Console.ReadLine(); }