1

I am new to Azure Event hub.

As per the examples there is a "Send" method in the Azure Event Hub client which sends the event synchronously, but is there something synchronous in the Receiver end.

To implement a Receiver we have to use the Event Processor Host class but all the register events are Async.

How do I trigger the receiver synchronously?

code_blue
  • 523
  • 2
  • 9
  • 19
  • Is there any problem having an async method ??? – Thomas Apr 15 '18 at 00:48
  • Will the receiver be triggered as soon as a message is in the Event Hub? – code_blue Apr 15 '18 at 00:55
  • Yeah is does not matter. – Thomas Apr 15 '18 at 01:02
  • What I am trying to get at is will the Azure Event Hub behave synchronously? A client sends and message and receiver responds? – code_blue Apr 15 '18 at 01:10
  • eventhub is designed to ingest data, it will not respond. I think you should have a look at servicebus + sessions – Thomas Apr 15 '18 at 01:12
  • Thanks Thomas for your answer. So to clarify the client which sent the message to Azure Event Hub will not know if the Receiver has read the Message or not. Is that correct? – code_blue Apr 15 '18 at 01:17
  • No it won't know. Could you explain a little bit more your use case please ? It will be easier to find the right service to use – Thomas Apr 15 '18 at 03:36
  • Web application in this case a Sender will send a request to event Hub and it needs to get back the data from the database. There will be a receiver which fetches the data from Event Hub and goes to the database. But not sure how the Receiver will send it back to the Sender. – code_blue Apr 16 '18 at 03:00
  • you can have a queue on the other way. The receiver put a message in a queue and the web app read the message – Thomas Apr 16 '18 at 03:36
  • The whole process in that case will be async? – code_blue Apr 16 '18 at 17:08
  • Yes. not sure if you need an eventhub, you can have only two queues or a queue with session enable. Sessions will allow you to give a response back to the webapp synchronously – Thomas Apr 16 '18 at 19:55
  • Are you referring to servicebus + sessions which you mentioned in your earlier comment? Thanks for your input though :) – code_blue Apr 16 '18 at 21:51
  • Yeah servicebus :-) – Thomas Apr 17 '18 at 07:58

1 Answers1

0

By default, the function that processes the events is called sequentially for a given partition. Subsequent events and calls to this function from the same partition queue up behind the scenes as the event pump continues to run in the background on other threads. Events from different partitions can be processed concurrently and any shared state that is accessed across partitions have to be synchronized.

See here

In summary, you will have as many concurrent threads as the number of partitions in a consumer group provided you process the message synchronously.