4

In my application, various events published to a Eventhub. But my consumer group needs only specific set of events. How to filter this in Eventhub?

K.P.
  • 105
  • 1
  • 9
  • 1
    You cannot. See the answer of [this](https://stackoverflow.com/questions/34003971/route-events-to-eventhub-eventprocessor) question – Peter Bons Apr 04 '18 at 17:47
  • Thanks @PeterBons . I get it. – K.P. Apr 05 '18 at 09:31
  • If you use eventgrid, you may be able to filter events ? check this article: https://learn.microsoft.com/en-us/azure/event-grid/event-grid-event-hubs-integration – Thomas Oct 18 '18 at 21:55

2 Answers2

2

Following this post:

event hubs doesn't support filtering as subscriptions on a topic for example and it's due to performance and thorughput reasons that need to be maximazed to have million events/sec for the ingestion system.

As @Sapnandu mentioned, you can use Azure Service Bus for this, or you can implement a filter yourself using Event Processor Host

For instance - when using the node module for EPH:

const onMessage = async (context, data) => {
  // use data to get message payload (data.body) and implement a filter here
  // suggestion: create an event name field for each message and query it here
};

const onError = (error) => {
  // do something with it
};

await eph.start(onMessage, onError);
ymz
  • 6,602
  • 1
  • 20
  • 39
0

Eventhub don't have any filter concept. You should use service Bus for filter the data after EventHub.

Sapnandu
  • 620
  • 7
  • 9