Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSE topic filters #2986

Merged
merged 1 commit into from
Jun 16, 2022
Merged

Fix SSE topic filters #2986

merged 1 commit into from
Jun 16, 2022

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented May 29, 2022

Fixes #2473

According to the documentation, topic filters are regular expressions. The SSE topic filters are converted to regular expressions, therefore openhab/items/*/state should result in openhab/items/.*/state. The code however adds a .* at the end openhab/items/.*/state.*. This makes it impossible to filter for /state but exclude /statechanged, which is IMO expected.

Signed-off-by: Jan N. Klug github@klug.nrw

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K added bug An unexpected problem or unintended behavior of the Core REST/SSE labels May 29, 2022
@J-N-K J-N-K requested a review from a team as a code owner May 29, 2022 21:43
@J-N-K J-N-K added rebuild Triggers the Jenkins PR build and removed rebuild Triggers the Jenkins PR build labels May 30, 2022
@ghys
Copy link
Member

ghys commented May 30, 2022

Please hold on merging this as the UI is probably making requests that assume the current syntax, so the impact has to be assessed.

@J-N-K
Copy link
Member Author

J-N-K commented May 30, 2022

According to the list you showed in the linked issue everything should be fine, since proper matching is done for all things, items, rules and addons (* at the end or where a wildcard should be used).

You would only be affected if you subscribed to openhab/items (without *) and expected a subscription for all topics starting with openhab/items. As long as a * is at the end of the filter, nothing changes.

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

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

LGTM! Did you already have a look @ghys?

@ghys
Copy link
Member

ghys commented Jun 16, 2022

Yes sorry I agree with @J-N-K's assessment! My earlier remark was just out of an abundance of caution, but it turns out it's fine.

@wborn wborn merged commit cdf876c into openhab:main Jun 16, 2022
@wborn wborn added this to the 3.3 milestone Jun 16, 2022
@J-N-K J-N-K deleted the bug-ssetopicfilter branch June 16, 2022 19:18
@J-N-K
Copy link
Member Author

J-N-K commented Jun 17, 2022

No, it‘ll only break if your subscription does not end with * AND you rely on an implicitly added * at the end (your subscription ends with state instead of state* but you expect to also cover statechanged).

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-3-3-release-discussion/136925/71

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/problems-subscribing-to-events-in-habapp/137124/6

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/habapp-1-0-beta-test/136952/25

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
Signed-off-by: Jan N. Klug <github@klug.nrw>
GitOrigin-RevId: cdf876c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core REST/SSE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSE topics filter not matching correctly
5 participants