@Jona Thanks for reaching out. It is possible that the messages are being reprocessed every time the function app restarts because the messages are still present in the Event Hub. When a function app is restarted, it will reprocess any messages that are still present in the Event Hub.
To avoid reprocessing the same messages, you can try the following:
Use a checkpointing mechanism to keep track of the last processed message. This will ensure that the function app only processes new messages that have not been processed before.
Configure the Event Hub to retain messages for a shorter period of time. This will ensure that messages are not retained in the Event Hub for a long time and are processed quickly.
Once the message is sent to the EventHub, it will be retained until the retention period expires any no. of consumers who knows the connection string of the particular EventHub can connect to it and it can read the events.
Note: it’s not like service bus where the message gets deleted once it is read.
Reference: https://video2.skills-academy.com/en-us/archive/blogs/servicebus/data-retention-in-event-hubs
do let me know if you have any queries.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.