简体   繁体   中英

Alternative to polling messages from Azure EventHub in SignalR application

I have an Azure EventHub, which sporadically gets data from various devices. I would like to process the data and send them to client applications via SignalR. However, it seems the only possibility to get the data is having an infinite loop in the SignalR server application, which will periodically poll for data from the EventHub ( http://blogs.msdn.com/b/musings_on_alm_and_software_development_processes/archive/2014/09/03/azure-event-hubs-queues-and-workers.aspx ).

The only optimization, I have found, is to use Back off polling ( http://www.developerfusion.com/article/120619/advanced-scenarios-with-windows-azure-queues/ ). Now I wonder - is there no better way to do the job? Both SignalR and EventHubs are there, to enable PUSH communication model. Are they not able to establish a bi-directional communication channel, which would allow them to send and receive messages based on events?

Are you sure that eventhub is the structure you need? Both Azure Queue and Azure Topics would provide you with an "OnEvent" signal in C# so that you can avoid polling. EventHub provides messages in a stream and is more intended for use with IoT signals in massive quantities and for Stream Analytics.

You can still, of course, forward messages to an eventhub after you've received a queue/topic message, if your architecture needs to visualize the stream of data, otherwise, I'd strongly consider Azure Topics or Azure Queue

https://azure.microsoft.com/en-us/documentation/articles/service-bus-queues-topics-subscriptions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM