从scedule任务服务调用集中信号-R集线器并更新客户端 [英] Call centralized signal-R hub from scedule task service and update the clients

查看:166
本文介绍了从scedule任务服务调用集中信号-R集线器并更新客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Centralized signal-R hub更新我的客户





*我已经托管了独立的Signal-R集线器



*我有独立的时间表任务服务



*我有测试申请



*我有开发申请





什么时候安排任务服务运行如果有的话数据无法在DB中更新我必须从服务中捕获这些数据并发送有关故障详情的通知,我想通过Centralized Signal-R中心发送这些通知



所以通知应根据我的配置更新测试应用程序客户端或开发应用程序客户端





WCF -----(故障数据,应用程序名称(DEV或测试))----> Signal-R HUB --- ----> 开发站点客户端或测试站点客户端




$ b $必须配置我的应用程序lication配置部分中的名称,因此根据配置它应该更新客户端



是否可能?给出一些示例代码



我尝试过:



我创建了信号中心,我可以从客户端访问,但我必须从WCF服务

I am trying to update my clients using Centralized signal-R hub


* I have hosted stand alone Signal-R hub

* I have stand alone schedule Task Service

* I have TEST Application

* I have Development Application


when ever schedule Task Service runs if any of the data failed to updated in DB i have to catch those data from service and send the notification regarding the failure details,i like to send those notification through the Centralized Signal-R hub

so the notification should update Test Application Clients or Dev Application Clients based on my configuration


WCF -----(Failure Data, Application Name(DEV orTest ))---->Signal-R HUB ------->Dev Site Clients or TEST Site Clients


i have to configure my application Name in configuration part so based on the configuration it should update the clients

is it possible ? give some sample code for this

What I have tried:

I have created signal hub i can access from clients but i have to done it from WCF Service

推荐答案

public class Service1 : IService1
 {
    

     private readonly IHubProxy messageHub;

     public Service1()
     {
         try
         {   // Create Connection To Signal-R Hub
             var connection = new HubConnection("<<Signal-R Hosted URL>>");
             messageHub = connection.CreateHubProxy("<<HUB NAME>>");
             connection.Start().Wait();
         }
         catch(Exception ex)
         {

         }

     }

     public void SendMessage()
     {
         //Calling particular methode in Signa-R Hub
         messageHub.Invoke("<<SignalR Methode>>", "<<Param1>>", "<<Param2>>");
     }
 }





*替换<<>>
中的数据
*它将自动更新您的客户,由上述信号r hub



* Replace your data in <<>>
* it ll automatically update your clients which is referred by the above signal r hub

这篇关于从scedule任务服务调用集中信号-R集线器并更新客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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