ably-java icon indicating copy to clipboard operation
ably-java copied to clipboard

Message interactions

Open AndyTWF opened this issue 2 years ago • 1 comments

This change implements the "subscription" aspect of the message interactions feature.

JIRA links:

  • Epic: https://ably.atlassian.net/browse/CON-6
  • Story: https://ably.atlassian.net/browse/CON-2

Spec points:

  • RTL22
  • MFI1
  • MFI2

It contains the following changes:

  • Introduction of the "MessageFilter" class as per MFI1/2. This allows the user to create and customise the filters they wish to apply to messages. The implementation is aimed to be idiomatic to how ClientOptions is instantiated in the library.
  • Introduction of a class (MessageExtrasFilter) that is responsible for applying the above filter settings given a message.
  • A manager class for MessageListeners that are "filtered" by the client - for management of listeners separate to the main channel object.
  • Addition of additional subscribe and unsubscribe overloads to ChannelBase to provide the necessary methods for users to use the new filters, as per RTL22.
  • README examples of publishing and subscribing to message interactions.

To test:

  • Create an instance of MessageFilter and specify whatever filters you'd like to use
  • Subscribe to a channel with that filter
  • Publish messages to the channel that match your filter, they should be received by your subscriber
  • Publish messages to the channel that do not match your filter, they should not be received by the connection (ie onMessage will be called), but not passed on to your subscriber.

Filters that can be tested:

  • Whether the event "name" matches that of the filter
  • Whether the publishing "clientId" matches that of the filter
  • Whether (or not) the message references another
  • Whether the referenced message timeserial matches the filter
  • Whether the reference type matches the filter

JS implementation for reference:

https://github.com/ably/ably-js/pull/1003

AndyTWF avatar Jul 19 '23 19:07 AndyTWF

Popped this back to draft for a second as I'm investigating a potential issue

AndyTWF avatar Jul 21 '23 16:07 AndyTWF