コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });

            var frameworkBus = RabbitMqBusFactory.CreateFrameworkBusWithReceiveEndpoint();

            Task.Factory.StartNew(async() =>
            {
                await frameworkBus.StartAsync();

                await RabbitQueuePublisher.SendToCoreQueue(new StringIntRequestModel
                {
                    IntValue    = 17,
                    StringValue = "CoreCall"
                });

                var response = await RabbitRpcPublisher.SendToCoreRpcQueue(new StringIntRequestModel
                {
                    IntValue = 13, StringValue = "FromFrameworkRpcCall"
                });

                Console.WriteLine($"int: {response.IntValue}, string: {response.StringValue}, time: {response.DateTime}");
            });
        }
コード例 #2
0
        private static async Task SendRequest()
        {
            var result = await RabbitRpcPublisher.SendToCoreRpcQueue(new StringIntRequestModel
            {
                IntValue    = _intValue++,
                StringValue = "FrameworkRpcCall"
            });

            Console.WriteLine($"{Environment.NewLine}string: {result.StringValue}, int: {result.IntValue}, date: {result.DateTime}{Environment.NewLine}");
        }