EventHubClient.Send: A message cannot be sent because it is either received from a link or is already sent over a link

There are two EventHubs in same EventHub namespace. I’m using EventHubClient.Send(EventData data) to send events, where both EventHubClient and EventData belong to Azure.Messaging.ServiceBus namespace.

I wish to send the same EventData to both EventHubs belonging to same EventHub namespace. The second EventHub which receives data after the first EventHub, silently drops the data with the following exception:

‘A message cannot be sent because it is either received from a link or is already sent over a link’

Can someone explain this behavior. I tried to find what this error means, but no luck.

>Solution :

In a nutshell, you cannot send the same EventData instance to multiple entities with the package that you’re using. You would need to create a new instance for each Event Hub.

The legacy package that you’re using tracks the AMQP delivery state as part of EventData. The error that you’re seeing indicates that the internal state sees this event as having already been sent and its delivery finalized.

If you’d prefer not to create a new EventData instance for this scenario, it may be worth considering updating to the current Azure SDK generation. The Azure.Messaging.EventHubs package does not have this limitation.

Leave a Reply