Ejemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var pubsubService = new PubSubService();

            pubsubService.CreateTopic();
            pubsubService.CreateSubscription();

            var simpleSubscriber = SubscriberClient.CreateAsync(PubSubService.SubscriptionName).Result;

            simpleSubscriber.StartAsync((msg, cancellationToken) =>
            {
                Console.WriteLine("{0}: Received new message: {1}", DateTime.Now.ToString("o"), msg.Data.ToStringUtf8());

                return(Task.FromResult(SubscriberClient.Reply.Ack));
            });
        }