Java Code Subscribing to Event Grid Topics

GRAY Mike 161 Reputation points
2024-02-21T16:51:05.85+00:00

Hi, I have developers on my project who are investigating how we can make Java code subscriber to an Event Grid Topic. Can anybody advise on this please as they are suggesting they need to implement an event hub consumer client and also either use a webhook client. Is this correct or can the Java code subscriber direct to the event grid topic. Could you provide any links or code examples to support how this can be achieved. Thanks Mike

Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
395 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,816 Reputation points Microsoft Employee
    2024-02-21T21:43:11.35+00:00

    Hi @GRAY Mike
    Welcome to Microsoft Q&A! Thanks for posting the question.

    As far as my understanding of your question, I believe your developers are correct and they need to either create a consumer client or a web hook as the Event Grid service doesn't store events and thus the Event Grid SDK doesn't have an event receiver instead events are stored in the event handlers (i.e. subscription's endpoint which stores the events sent to the topic or domain) like Azure Storage, Azure Event Hubs, App Configuration etc.

    You may then use the event handler's SDK to receive events in Json string which can be deserialized using EventGridEvent.fromString() or CloudEvent.fromString().

    You can refer to Receiving and Consuming Events section for details. You can also refer to GitHub sample for additional details.

    Also, refer to Subscribe to events through portal which describes how to create an event grid subscriptions through the portal. Please let me know if you have any other questions. Thanks Saurabh

    Please 'Accept as answer' and Upvote if it helped so that it can help others in the community looking for help on similar topics.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.