Kernel::System::PushEvent::Subscription

NAME

Kernel::System::PushEvent::Subscription – Manager for push event subscriptions.

DESCRIPTION

This class handles the subscriptions on push events, that are coming from the frontend. Clients have the possibility to subscribe to events, which will be prepared, based on the stored subscriptions. Furthermore this class handles the refresh and deletion, as well as the cleanup of expired entries.

PUBLIC INTERFACE

MethodParamValidationSchema()

Extend the original 'MethodParamValidationSchema' of the base class to fit the schemata of the subscription management.

Refresh()

Refreshes the given subscriptions for given front end client ID.

    my $Success = $PushEventSubscriptionObject->Refresh(
        FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',
        Subscriptions => [
            'TicketSubscribe::TicketID::<:PositiveInt>',
            'TicketSubscribe::TicketID::1234::StateUpdate',
            'TicketSubscribe::TicketID::1234::Subscribe',
        ],
    );

Returns true if the records were refreshed successfully.

GetLastRefreshTime()

Get the last refresh time from the cache.

    my $LastRefreshTime = $PushEventSubscriptionObject->GetLastRefreshTime();

Returns:

    $LastRefreshTime = '2019-03-10 00:10:00';

List()

Get a list from the push event subscription table.

    my $SubscriptionList = $PushEventSubscriptionObject->List(
        FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',         # optional
                                                                            # or
        Name             => 'TicketSubscribe::TicketID::<:PositiveInt>',    # optional

        SkipExpiryCheck  => 0|1,                                            # optional
    );

Returns:

    $SubscriptionList = [
        {
            ID               => 12,
            Name             => 'TicketSubscribe::TicketID::<:PositiveInt>',
            FrontendClientID => '2efabb5d-3b5a-11e9-8e1f-b9297ec29298',
        },
        {
            ID               => 13,
            Name             => 'TicketSubscribe::TicketID::1234::StateUpdate',
            FrontendClientID => '2efabb5d-3b5a-11e9-8e1f-b9297ec29298',
        },
    ];

ManagerList()

Get a all subscriptions names and the relevant front end client IDs which are not expired.

    my $ManagerList = $PushEventSubscriptionObject->ManagerList();

Returns:

    $ManagerList = {
        'TicketSubscribe::TicketID::<:PositiveInt>' => [
            '3fbeb6f9-4197-11e9-a2ee-d4f0e15b1ca6',
            '3fbec35b-4197-11e9-a2ee-85df98e183aa'
        ],
        'TicketSubscribe::TicketID::1234::StateUpdate' => [
            '3fbeb6f9-4197-11e9-a2ee-d4f0e15b1ca6'
        ],
    }

NamesPerFrontendClientID()

Get a list of names from the push event subscription table.

    my $SubscriptionNames = $PushEventSubscriptionObject->NamesPerFrontendClientID(
        FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',
        SkipExpiryCheck  => 0|1,                                    # optional
    );

Returns:

    $SubscriptionNames = [
        'TicketSubscribe::TicketID::<:PositiveInt>',
        'TicketSubscribe::TicketID::123::StateUpdate',
    ];

FrontendClientIDsPerName()

Get a list of front end client IDs for the given name.

    my $FrontendClientIDs = $PushEventSubscriptionObject->FrontendClientIDsPerName(
        Name            => 'TicketSubscribe::TicketID::<:PositiveInt>',
        SkipExpiryCheck => 0|1,                                # optional
    );

Returns:

    $FrontendClientIDs = [
        '846ba13b-367a-11e9-ab58-eec271d3f95e',
    ];

Delete()

Delete items from to the push event subscription table.

    my $Success = $PushEventSubscriptionObject->Delete(
        FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',
        Name             => 'TicketSubscribe::TicketID::<:PositiveInt>',
    );

Returns true if the records was deleted successfully.

CleanupExpired()

Cleans up all expired push event subscriptions.

    my $Success = $BrowserTrustObject->CleanupExpired();

Returns 1 if expired push event subscriptions were cleaned up successfully.

CleanUpIllegal()

Cleans up all illegal push event subscriptions.

    my $Success = $BrowserTrustObject->CleanUpIllegal();

Returns 1 if expired push event subscriptions were cleaned up successfully.

PRIVATE INTERFACE

_Add()

Adds the given subscriptions to the push event subscription table.

    my $Success = $PushEventSubscriptionObject->_Add(
        FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',
        Subscriptions => [
            'TicketSubscribe::TicketID::<:PositiveInt>',
            'TicketSubscribe::TicketID::1234::StateUpdate',
            'TicketSubscribe::TicketID::1234::Subscribe',
        ],
    );

Returns true if the records was added successfully.

_SetRefreshTime()

Set the refresh time after something was changed in the subscription table.

Scroll to Top