Closed chrrust closed 3 months ago
I can add that this is also problematic in our case if we would decide to do a workaround for #550 by creating a subscription for all event types on a resource by omitting the event type filter. This because we already have subscriptions for each event type, and I'd be risking losing out on events if I would have to delete the existing subscriptions on the resource in order to create one for all of them.
Fix verified in at22
Description of the bug
I'm trying to create a new subscription for the resource
urn:altinn:resource:dgm-internal-events
without specifying an event type filter. Generic events are published for this resource.I already have a subscription on that resource, but that subscription specifies an event type filter. When I try to create a new subscription without the event type filter, I get returned the already existing subscription with an event type filter. Thus, no new subscription is created.
As far as I can see, this happens because in
SubscriptionService.CompleteSubscriptionCreation
the_repository.CreateSubscription
statement is happening only if a subscription could not be found. However, the_repository.FindSubscription
function that does the following condition:So, because my input to the creation of the subscription is null, it will return whatever subscription it finds for that resource. This makes the
_repository.CreateSubscription
function to never be called, and instead that subscription that was found is queued for validation and returned.I'd expect a check to see if the found subscription is indeed the attempted created subscription.
Steps To Reproduce
Now see that the subscription from step 1 is returned, and not the one from step 2. Only one subscription will have been created, and that's the first one.
Additional Information