Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
The AzureEventProvider is a public class and quite a few of the methods of overridable. As that value is set in the constructor you could create a custom version inheriting it and inject it in as the default.
The problem is that SubscriptionName only has a Getter, which uses the private variable _uniqueName which is set in the DefaultServiceBusEventProvider constructor.
So there is no way to set _uniqueName without duplicating DefaultServiceBusEventProvider or maybe using Reflection to set _uniqueName in a inherited class.
I don't see any code relating to DefaultServiceBusEventProvider in any projects I've got on DXP/Azure.
There's an AzureEventProvider which you mentioned in your post and the one I was looking at which has
public AzureEventProvider(
AzureEventClientFactory clientFactory,
EventsServiceKnownTypesLookup knownTypesLookup,
IServiceBusSetup setup)
{
this._clientFactory = clientFactory;
this._knownTypesLookup = knownTypesLookup;
this._uniqueName = Environment.MachineName.Replace('/', '_').Replace(':', '_') + Guid.NewGuid().ToString("N");
this._serviceBusSetup = setup;
}
To which as this is a public non sealed class I woud just
public CustomAzureEventProvider : AzureEventProvider
{
public AzureEventProvider(AzureEventClientFactory clientFactory,
EventsServiceKnownTypesLookup knownTypesLookup,
IServiceBusSetup setup)
{
this._clientFactory = clientFactory;
this._knownTypesLookup = knownTypesLookup;
this._uniqueName = WHATEVER YOU LIKE
this._serviceBusSetup = setup;
}
}
Then just configure structuremap to use this instead
This actually might be a bug that needs to be fixed by Opti. What if I take my site and host it in AKS (for example). They have pretty long pod names that sometimes exceed 50 chars.
I have created an implementation over AzureServiceBusProiver which resolves this issue by using reflection. Actually the way i found this bug was when using Kubernetes and a Pod in a Deployment, which gets a hash suffix appended to its MachineName. I have created a issue in Customer suggestions aswell, so hopefully Optimizely will see the error and fix it
The implementation can be found here along with some self promotion to my post 😁 https://dev.to/stoffe/optimizely-on-kubernetes-4k9n
Hello!
I am getting an issue when using AzureEventProvider due to SubscriptionName is longer than 50 characters. After some investigation with ILSpy i found out that the SubscriptionName as following:
This makes so the machine name can only be 14 characters long. A suggestion could be to have a SubscriptionName Setter in AzureEventProviderOptions.
or maybe there is another way to set that I havent found?