How to connect Function app and Event Grid?

Vlad K 0 Reputation points
2024-06-17T17:46:15.78+00:00

Hey,

I have two questions that are related to Event Grid and I'd be happy for any help.

My idea is to have a function app that sends an event to another function app. For that I have created a topic in my Event Grid and set receiver function as a subscriber. At this point I realized that apparently function app won't allow Event Grid to push any message because it treats it as a message from the "outside". So I came up with a solution where EG sends an event to Storage Queue and then receiver function picks up the message. However, now I have a problem with sender function. I thought that credentials (such as topic endpoint and access key) is enough for function app to send an event to EG. But I get ServerRequestError; EOF occurred in violation of protocol (_ssl.c1133) when I try to send it. (in my local setting everything event is sent to EG without any problem).

  1. So my question is how would I solve this situation? Tbh I'm not even quite sure about the relationship between different Azure products and why Storage Queue/Service Bus works fine with my Function App and Event Grid is treated differently. So some clarification would be appriciatied as well.
  2. I also tried to test EG Domains and Function app output binding when I send and an event. I use v2 and set it as following:
func_name = func.Blueprint()

@func_name.time_trigger(schedule = "0 0 10-16 * * 3-4", arg_name = "Name")
@func_name.event_grid_output(
						arg_name = "Output",
						topic_endpoint = "topic_endpoint",
						topic_key_setting = "key")

def function(TimeTrigger: func.TimerRequest, 
			outputEvent:func.Out[func.EventGridOutputEvent]) -> None:
....

outputEvent.set(
	id = "test_id",
	data = {},
	subject = "test", 
	event_type = "event", 
	data_version = "v1")
 

But when I run this code locally it requires to provide the name of the Domain topic but I don't know where to specify that (neither event_grid_output nor outputEvent.set can have Domain topic name) and it seems there is not much about that in documentation.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,113 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
394 questions
0 comments No comments
{count} votes

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.