Skip to content

CompletedEventPublications: how to use correctly? #767

@micama

Description

@micama

Hi

I am trying to delete the completed events using CompletedEventPublications.deletePublications but unsure on what the best practice is, since the docs don't say much about it.

Btw, I am aware of #748.
This is a general question on how to actually trigger the action, for the case where one wants to use this functionality manually.

Is there a preferred way of using the API that works automatically or must the action always be "triggered" manually somehow?

Currently I am doing something like

@Component
@EnableScheduling
public class CompletedEventsCleaner {
    private final CompletedEventPublications completedEvents;

    public EventsCleaner(final CompletedEventPublications completedEvents) {
        this.completedEvents = completedEvents;
    }

    @Scheduled(initialDelay = 5000, fixedDelay = 5000)
    public void deleteCompletedEvents() {
        completedEvents.deletePublications(EventPublication::isPublicationCompleted);
    }
}

Is this correct?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions