I am using Event Hub, wanted to know which one is better approach to consume events Event Processor Host or Direct Receivers. if one of it is better then why.
Also Can you help me any java code sample github or java Azure SDK to write event consumer.
Does using partitions and consumer groups is better approach?
No matter how you consume events, you alway have at least one consumer group and at least 2 partitions. It is not optional.
Plenty of docs available to get started
According to the docs:
Regarding direct consumers:
When using direct consumers you need to manually do the checkpointing. Using the Processor Host takes that away. Also, load distribution is better handled using the Processor Host