Reputation: 3003
I have 2 consumer groups in event hub. It is being used by Synapse to push event and then consumed by Azure function and then AZ function pushes to event hub and gets consumed by Logic App. Name of Eventhub: school - Consumer group: Student, Teacher. Earlier I had two different event hubs for both work now I am using consumer group for that.
I was earlier using Synapse to push my event only in event hub and that was simple :
https://myschool-integration.servicebus.windows.net/school/messages
Need help to push data in specific Consumer group in this case Teacher.
In Azure function I use this code to push data to event hub, but not sure how to push it to specific consumer group.
def send_event_data_batch(json_string):
try:
producer = EventHubProducerClient.from_connection_string(
conn_str=EVENT_HUB_CONNECTION_STR,
eventhub_name=school,
)
with producer:
event_data_batch = producer.create_batch()
event_data_batch.add(EventData(json_string))
producer.send_batch(event_data_batch)
except:
logging.error(f"Failed to send data to Event Hub")
raise
I need to use consumer group because now every time an event reaches eventhub, it triggers both the function and logic app. So there are 2 attempts.
Upvotes: 0
Views: 1189
Reputation: 7745
You cannot publish events to a specific consumer group. A consumer group is not a physical boundary for data, it is just a label to apply for a logical grouping of readers.
There is only one event stream for an Event Hub; all consumers read from it regardless of what consumer group they identify as.
Upvotes: 1