如何在将新数据插入azure表存储时立即得到通知 [英] How to get notified as soon as new data gets inserted into azure table storage

查看:73
本文介绍了如何在将新数据插入azure表存储时立即得到通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure表存储,其中数据预计将从Web服务插入。



我的应用程序(ASP.Net MVC,VS 2017)具有SignalR实现从Azure表存储接收任何更改的数据。



我的问题



新数据到达表存储后,只有当我刷新浏览器时,最新数据才会自动反映在任何其他打开的浏览器中 - 无论是在相同或不同的计算机系统中。它不会自动显示任何已打开的更改值浏览器一旦新数据进入表存储。我想这可能是因为当我刷新浏览器时,根据我的代码,它从Table和SignalR中获取数据,将数据发送给其他客户端。



所以每当新数据到达时,从表中发送通知都存在差距。



我的查询



我在这里缺少什么 - 它没有自动显示浏览器的最新数据?

或者表存储没有任何通知机制来通知新的数据来了吗?如果是这样,只要新数据到达Azure表存储,应该做什么接收通知?



我尝试过:



我的行动方式

I have an Azure Table Storage where data is expected to be inserted from a web service.

My App (ASP.Net MVC , VS 2017) has SignalR implemented to receive any changed data from Azure Table Storage.

My Problem

After a new data arrives in Table Storage, only if I refresh a browser, the latest data automatically gets reflected in any other opened browsers - either in same or different computer systems.It doesn't automatically display the changed value in any opened browser as soon new data gets into Table Storage. I guess this may be because when I refresh the browser, as per my code it gets the data from Table and SignalR fires to send the data to other clients.

So there is a gap here in sending notification from the Table whenever new data arrives.

My Query

What is that I am missing here - it doesn't show the latest data on the browser automatically?
Or is it that Table Storage do not have any notification mechanism to notify new-data-arrived? If so what should be done receive notification whenever a new data arrives into Azure Table Storage?

What I have tried:

My Action Method

[HttpGet]
    public ActionResult Index()
    {
        var model = SignalRepository.LatestSignalCollection();// Connects with Azure to fetch the latest 5 records
        return View(model);

    }





我的SignalR Hub代码



My SignalR Hub Code

public SignalHub()
    {
        SignalRepository.SignalSubscriber();
        var signalData = SignalRepository.LatestSignalCollection(); //LatestSignalCollection() ===>  Connects with Azure to fetch the latest 5 records
        GetAllClients().All.SendSignalData(signalData);

    }







我的js文件 - SignalR Connect代码






My js file - SignalR Connect code

var signalHub = $.connection.signalHub; //alert("ACCC");
$.connection.hub.logging = true;
// Start the hub
$.connection.hub.start();
signalHub.client.SendSignalData = function (signalData) {
     updateSignalData(signalData);// updates the elements in Index.cshtml
}

推荐答案

.connection.signalHub; // alert(ACCC);
.connection.signalHub; //alert("ACCC");


.connection .hub.logging = true ;
// 启动集线器
.connection.hub.logging = true; // Start the hub


.connection .hub.start();
signalHub.client.SendSignalData = function(signalData){
updateSignalData(signalData); // 更新Index.cshtml中的元素
}
.connection.hub.start(); signalHub.client.SendSignalData = function (signalData) { updateSignalData(signalData);// updates the elements in Index.cshtml }


这篇关于如何在将新数据插入azure表存储时立即得到通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆