Ejemplo n.º 1
0
        static void Main(string[] args)
        {

            var calculatorModule = new CalculatorModule();
            var calculatorRpcServer = new RabbitRpcServer<ICalculator>("host=localhost;username=guest;password=guest;virtualHost=rabbitCommunicationTest", "rabbit.test", calculatorModule);
            calculatorRpcServer.Connect();

            Console.ReadLine();

            calculatorRpcServer.Close();
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            Server = new ServerMock();

            RabbitRpcServer = new RabbitRpcServer <IServerTest>(ConnectionString, BrokerId, Server);
            RabbitRpcClient = new RabbitRpcClient <IServerTest>(ConnectionString, BrokerId);
            ServerProxy     = RabbitRpcClient.GetServerProxy();

            RabbitRpcServer.Connect();
            RabbitRpcClient.Connect();
        }
        public void Setup()
        {
            Server = new ServerMock();

            RabbitRpcServer = new RabbitRpcServer<IServerTest>(ConnectionString, BrokerId, Server);
            RabbitRpcClient = new RabbitRpcClient<IServerTest>(ConnectionString, BrokerId);
            ServerProxy = RabbitRpcClient.GetServerProxy();

            RabbitRpcServer.Connect();
            RabbitRpcClient.Connect();
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(IMessageQueueInfoFactory messageQueueInfoFactory)
        {
            ValidateUtil.ValidateNull(messageQueueInfoFactory, "消息队列信息工厂");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), messageQueueInfoFactory);

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(MessageQueueInfo messageQueueInfo)
        {
            ValidateUtil.ValidateNull(messageQueueInfo, "Rabbit消息队列信息");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), RabbitMessageQueueInfo.From(messageQueueInfo));

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            var calculatorModule    = new CalculatorModule();
            var calculatorRpcServer = new RabbitRpcServer <ICalculator>("host=localhost;username=guest;password=guest;virtualHost=rabbitCommunicationTest", "rabbit.test", calculatorModule);

            calculatorRpcServer.Connect();

            Console.ReadLine();

            calculatorRpcServer.Close();
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="queueOrOtherIdentify">队列或其他标识</param>
        /// <param name="messageQueueInfoFactory">消息队列信息工厂</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(string queueOrOtherIdentify, IMessageQueueInfoFactory messageQueueInfoFactory)
        {
            ValidateUtil.ValidateNull(messageQueueInfoFactory, "消息队列信息工厂");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), queueOrOtherIdentify, messageQueueInfoFactory, virtualPath: virtualPath);

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
Ejemplo n.º 8
0
 public void TearDown()
 {
     RabbitRpcClient.Close();
     RabbitRpcServer.Close();
 }