示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
文件: Program.cs 项目: Akrotiri/twino
        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();
        }