vmeretail / subscriptionservice

Lightweight and easy to use library, which allows you to manage you delivering events from persistent subscriptions.
12 stars 0 forks source link

Ignore System Events #12

Closed StuartFergusonVme closed 4 years ago

StuartFergusonVme commented 4 years ago

Add in a configuration option that System Events (EventType starts with $).

StevenBlair123 commented 4 years ago

How will this be configured? Will the Subscription Service ctor accept configuration, and the hosting process rips it from appsettings.json or perhaps each Subscription that gets created as this as a field?

StuartFergusonVme commented 4 years ago

I seen this really as across the board but maybe on subscription with a default of true?

StevenBlair123 commented 4 years ago

Yeah, that might be better. So perhaps the property is "Don't ignore system events" ?

StevenBlair123 commented 4 years ago

If you have a look at EventAppeared in SubscriptionServce.cs, the following code is responsbile for filtering out system events:

                if (resolvedEvent.Event == null)
                {
                    subscription.Acknowledge(resolvedEvent);
                    return;
                }

I wonder if we should even bother having this as a configuration option.

What would the use case be for allowing these events through?

StuartFergusonVme commented 4 years ago

There is also this bit as well:

    if (ignoreSystemEvents && resolvedEvent.Event.EventType.StartsWith("$"))
    {
        subscription.Acknowledge(resolvedEvent);
        return;
    }
StevenBlair123 commented 4 years ago

To be clear this job is now as follows:

Add in the following code (or similar) in EventAppeared:

   if (resolvedEvent.Event.EventType.StartsWith("$"))
    {
        subscription.Acknowledge(resolvedEvent);
        return;
    }

This will not be configurable.

As well as that, if the resolvedEvent.Event is also null, we should also acknowledge the event.