Project

General

Profile

Tigase ACS : How to get online clients on Custom Component (extended from tigase.component.AbstractComponent)?

Taras Panchak
Added almost 2 years ago

Hello!

Could you please help to solve this problem:

We are using Tigase with ACS with cached presence (sess-man/cluster-strategy-presence-cache=true).

And have custom component (extended from tigase.component.AbstractComponent) which is deployed on Tigase server.

How to detect which clients are online (for all cluster nodes) using this component?

I found some info here

https://projects.tigase.org/boards/4/topics/6284?r=6304#message-6304

but how to get access to tigase.cluster.strategy.OnlineUsersCachingStrategy using our custom component?

May somebody provide code samples how to do it?


Replies (6)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

Instance of tigase.cluster.strategy.OnlineUsersCachingStrategy is available only in SessionManagerClustered@. It should be possible to retrieve it with @getStrategy() method, but it is not available outside of @SessionManagerClustered@.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 2 years ago

To expand on the Andrzej's explanation. The best way to get the data you need from the clustering strategy object is to extend SessionManagerClustered class and implement data retrieval logic in your custom class. The logic can provide this data to the custom component that you have.

Then, you can configure the Tigase XMPP Server to load your version of the SessionManagerClustered instead of the default one.

Please be careful when handling the clustering strategy data. It might be quite large data set, so copying the whole cache to make more instances is not recommended. Also, for security reasons, be careful to not expose the data to not authorized third-party, plus, make sure you do not modify the data which belongs to the clustering strategy.

Added by Taras Panchak almost 2 years ago

Could you please explain how to "configure the Tigase XMPP Server to load your version of the SessionManagerClustered instead of the default one" ?

Does it mean to change only:

etc/init.properties:--sm-cluster-strategy-class=tigase.server.cluster.strategy.MyCustomOnlineUsersCachingStrategy

?

Added by Taras Panchak almost 2 years ago

After changes in etc/init.properties:

MUCComponentClustered.() SEVERE: You've tried using Clustered version of the component but ACS is disabled

MUCComponentClustered.() SEVERE: Shutting down system!

Added by Petro Zdeb almost 2 years ago

Hi #{Artur Hefczyc}, @Andrzej Wójcik, Taras configured Tigase with ACS without License. ACS works fine without the license on our dev environment with original OnlineUsersCachingStrategy, but refuses to start for custom strategy class (inherited from OnlineUsersCachingStrategy).

Could you please help?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

Clustered versions of MUC and PubSub component are protected to work only with OnlineUsersCachingStrategy directly, so it would not be possible to override it and change its behaviour, which could lead to issues.

I do not get why you decided to override OnlineUsersCachingStrategy as Artur clearly stated that you would need to override SesssionManagerClustered class and use it later on (configure your implementation extending SessionManagerClustered as a class for sess-man component).

    (1-6/6)