I am stuck in a matter of a little while, and I hope someone can help me with Ezur Attempting to get data from the EventHub and I am trying to display these figures (in real time) on an ASP.NET page using MSc.
I have found a way to create an asynp system that will wait to get an event, and I have refreshed this method and partial footage with jQuery in every second, but I found it to me Give very volatility over time and it will end in an endless loop of errors.
Here is my code:
Public ASINCC Tasks & lt; Action & gt; Index () {time = date time.Now; List = new list & lt; TestEntity & gt; (); TestEntity T = New TestEntity (); List.Add (t); Awaiting start (); See Return (List); } Public async works & lt; ActionResult & gt; RefreshLatest () {try {var message = Wait for the consumer. ResaveSync (); If (message! = Null) {TestEntity t = JsonConvert.DeserializeObject & lt; TestEntity & gt; (Encoding. UTF8.GetString (message.GetBytes ()); List.Add (t); }} Hold (exception exception) {Console.WriteLine ("Exception {0}", Exception Message); } Return partial view ("latest", list); } Private Static async Task Initialize () {EventHow Client EventHow Client = getEventHubClient (SharedAccessKeyName, SharedAccessKey, NamespaceURI, EventHubName, ConnectionString); Event Hub Compilation Group Consumer Factor = eventHubClient.GetDefaultConsumerGroup (); Wait for consumer = consumer group. Buyer Reciever Ascin (split ID, datetime. Now, receiver apoc); // all messages} public static eventHow client getEventHubClient (String Share EntryName, String Share Entry, String Namespace UI, String EventHowname, String Connection String) {// EventHeb Talkprovider TD = Token Provider Create the best access provider (shared name, shared entourage); Nameshut Manager Manager = New namespace manager (NamespaceURI, TD); Var details = manager.CreateEventHubIfNotExists (EventHubName); // Event Hub Client Event CreateHub Client Client = EventHubClient.CreateFromConnectionString (ConnectionString + "; EntityPath =" + EventHubName); Return customer; } And here is my index view:
I hope you can see what I'm trying to accomplish And how does this fail?
No comments:
Post a Comment