Skip to content

Conversation

@armiol
Copy link
Contributor

@armiol armiol commented Mar 6, 2023

This changeset adds an ability to subscribe to changes in Entity states, which make them no longer matching the subscription criteria.

In particular, this will always be the case if Entity becomes archived or deleted.

The new endpoint is available for Spine client under whenNoLongerMatching() DSL, and is a part of Client's request API:

    Client client = client();
    client
        /* ... */
        .subscribeTo(Task.class)
        .observe((task) -> { /* ... */ })
        .whenNoLongerMatching(TaskId.class, (idOfNonMatchingEntity) -> { /* ... */})
        .post();

These changes will also become available to other clients (such as web-related client), once this PR is merged.

The library version is now set to 1.9.0-SNAPSHOT.10.

@armiol armiol self-assigned this Mar 6, 2023
@armiol armiol marked this pull request as ready for review March 6, 2023 13:54
@armiol
Copy link
Contributor Author

armiol commented Mar 6, 2023

@alexander-yevsyukov @dmdashenkov PTAL.

Copy link
Contributor

@dmdashenkov dmdashenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple of minor suggestions.


@Override
protected Optional<StreamObserver<SubscriptionUpdate>> chain() {
if(null == nlmConsumer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(null == nlmConsumer) {
if (null == nlmConsumer) {

/**
* Handles the {@link EntityDeleted} events in respect to the {@code Subscription}.
*/
final class EntityRemovalHandler extends NoLongerMatchingHandler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EntityDeletionHandler?

@armiol armiol merged commit c8c159e into 1.x-dev Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants