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

Newly created MUC chat service(while creating MUC room) is not clustering. #30

Open
mayurtailor009 opened this issue Jul 31, 2019 · 14 comments

Comments

@mayurtailor009
Copy link

Hi team,

I am working in openfire cluster environment. I have 2 node of openfire say as node_1 and node_2. When i create new MUC room(as chat_room1) with new chat service(as service_1). It creates MUC room as chat_room1 and service as service_1 on node_1 but not on node_2 because the chat service(service_1) is not clustering(sync) on another node(node_2).

As i see in createRoom method, call of ServiceAddedEvent is not there to cluster the chat service.
Please fix this issue, it very critical for me.

Thanks

@wrooot
Copy link

wrooot commented Jul 31, 2019

How is this related to Rest Api? Maybe you should close this and post in Hazelcast clustering plugin repo or in the forums, if the issue is with Openfire itself rather than with the plugin.

Btw, telling that this is critical to you won't do anything. There are only a few volunteers with limited time here. If this is really critical to you, pay someone to create a patch.

@mayurtailor009
Copy link
Author

Hi @wrooot
Below code should be there(MUCRoomController.java->createRoom method) to clustering the chat service as doing for chat room while creating chat room using rest api:-
if (ClusterManager.isClusteringStarted()) { CacheFactory.doClusterTask(new ServiceAddedEvent('service_1','service_1',false); }

Please let me know if i am going in another direction.

@GregDThomas
Copy link
Contributor

You can actually call just

CacheFactory.doClusterTask(...);

as it's a null event for non-clustered setups.

However, it's not a ServiceEvent you want - that just simply tells the other nodes that a service has been added, not that a room has been created. I'm not sure exactly what the cluster task you need is, you may have to dig a bit deeper in the code for that.

Greg

@mayurtailor009
Copy link
Author

@GregDThomas , Thanks for your input.

Let me explore more in code of rest api and openfire.

@mayurtailor009
Copy link
Author

Hi @GregDThomas
I want is to sync newly created chat service on all the clustered openfire nodes when new room with new chat service created.

@GregDThomas
Copy link
Contributor

I've not spent much time in this area of code, so am not entirely confident of my next statement, but ...

I would expect that there is only one chat service that serves all rooms - so there is no need to create a new one on the other nodes in the cluster.

I note that there is no code that references a ServiceAddedEvent in the core Openfire code; so whatever code creates a MUC room via the normal method manages to get it shared across the cluster without using ServiceAddedEvent. For example, MultiUserChatServiceImpl, c. line 728, does so by calling a cluster task for the new room and each of the new rooms occupants. https://github.com/igniterealtime/Openfire/blob/master/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java#L728

Aside; if you running Openfire 4.4.0 then clustering is broken, which may explain the problem you're seeing.

@mayurtailor009
Copy link
Author

@GregDThomas thanks for your inputs.
I am working on multi-tenant web application where each tenant have own chat service and own chat rooms. User can create N number of tenant at run-time, that is the reason i need new chat service for new tenant and that chat service needs to sync in all nodes of cluster.

@GregDThomas
Copy link
Contributor

Ah, OK in which case you may well be right in your original use of ServiceAddedEvent() - but your best bet is to try and fix your proble, and if it works, submit a PR!

@GregDThomas
Copy link
Contributor

This has also arised over at igniterealtime/openfire-hazelcast-plugin#30

It's essentially the same issue (I think) so it looks to me like a bug in core Openfire, not any of the plugins.

@GregDThomas
Copy link
Contributor

I believe this if fixed in I believe this is now fixed in igniterealtime/Openfire#1479

@GregDThomas
Copy link
Contributor

@ajaygajra
Copy link

@GregDThomas hello,
seems like the issue is not fixed and it persists.

@Fishbowler
Copy link
Member

I'm seeing something similar. When I'm in a cluster and I create a room, the room exists properly in the database, but is incorrect in the cache. When I look at it in the cache, the settings are wrong, the ID is -1, and the savedToDB value is False.

I've opened PR #111 that duplicates the same code that the Admin interface uses, to explicitly sync the cache when creating or updating a MUC.

@lijianM
Copy link

lijianM commented Oct 31, 2022

@GregDThomas thanks for your inputs. I am working on multi-tenant web application where each tenant have own chat service and own chat rooms. User can create N number of tenant at run-time, that is the reason i need new chat service for new tenant and that chat service needs to sync in all nodes of cluster.

Hey, how did you finally solve the muc cluster problem? Is the MultiUserChatServiceImpl class modified? Or is it more wiretapping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants