Reputation: 753
I have been trying to publish events to an Azure EventGrid using Azure.Messaging.EventGridEvent.EventGridPublisherClient
and it works out just fine. I just discovered that there is another client for EventGrid, namely Microsoft.Azure.EventGrid.EventGridClient
.
Upon investigation, both libraries and namespaces achieve the same thing, but expose vastly different methods and properties, and handle serialization and deserialization of Data
very differently; while Microsoft.Azure.EventGrid.EventGridEvent
directly exposes the Data
property as a public
property, Azure.Messaging.EventGridEvent
has Data
as an internal
property and only exposes methods like GetData<T>
, and GetDataAsync<T>
.
Having two libraries do almost similar things has left me totally confused as to which one is the right library to use. Are there any guidelines as to when should we use one library over the other? Are there any benefits to using one over the other? I tried looking into the documentation but couldn't discern any information about the correct usage of either of these libraries.
Upvotes: 5
Views: 1263
Reputation: 29711
Microsoft is busy creating new packages for their Azure SDKs. Currently there are major differences in the way the Azure SDK packages work. To address this they have defined new SDK design guidelines and they are in the process of replacing all Azure SDKs with new ones based on these guidelines.
The Microsoft.Azure.EventGrid package is stable but is not following these new guidelines. The Azure.Messaging.EventGrid package is in preview but does follow the guidelines. Depending on your situation you might now want to use preview libraries. So you can stick to the stable one and replace it eventually if needed.
Upvotes: 5