PubSub notifications in clustered environment problem

Hi everyone,

I have two nodes with Openfire 3.9.3 installed and clustered using Hazelcast 1.2.2 plugin. Both nodes are behind HAProxy acting as a load balancer. Everything works fine, except one scenario, which I believe should also work in a clustered environment:

  • client 1 connects to Openfire node A (over HAProxy load balancer) and subscribes to PubSub node N;

  • client 2 connects to Openfire node B (over HAProxy load balancer) and publishes to PubSub node N;

  • client 1 is NOT receiving notification that there is a published item on PubSub node N;

This works fine if client 2 happens to connect to the same node as client 1 (Openfire node A in our case).

Is there anything that I need to set up on the server to make this work?

OK, thanks for reporting … that scenario should definitely be supported. In fact, I’m pretty sure I’ve seen it working at some point, so will need to investigate. Tracking here: OF-871.

Thanks Tom for raising the issue… BTW, reading its description led me to checking the Openfire sources (3.9.3 code base, the version that I am using), but unfortunately I was unable to find any PublishTask class definition, or any other class with similar name. Even more, I found out that, among the bunch of CacheFactory.doClusterTask() invocations, no such action is triggered when publishing an item to a PubSub node, so I am afraid that publishing on other cluster members was never implemented. Am I missing something?

Sorry, I was working from memory … published items are distributed via the routing mechanism based on the affiliations list for the node. We are not using cluster tasks for this as I had alluded earlier.

To troubleshoot, you might take a look at the affiliation for the subscriber (client 1 in your case). Is the client subscribed using a full jid, or a bare jid? Also, there are various options for using presence-based subscriptions and access controls as well. Finally you will want to ensure that a published item is distributed to all connected subscribers, not just the highest priority session.

Judging by the entry in ofPubsubAffiliation database table, client is subscribed using bare jid, but, on the other hand, based on the IQ subscription response, full jid is used, so I don’t know which one is used actually.

Regarding the access control, I am using “Authorize” access model, but this seems to cause no problems because, as I mentioned in my original post, in case when both publisher and subscriber are connected to the same Openfire node, the subscriber is properly receiving notifications.

I already started to get deeper understanding of the Openfire sources, and the next step is trying to implement new cluster task which will propagate event notifications to other cluster members. Hope to get back with results soon.

If anyone is interested, I have succeeded to solve this issue with simply introducing new cluster task, triggered when PubSub service sends notification about new published item

Is this issue still relevant with Openfire 4.1.6 release? Would you kindly consider creating a github pull request with this change if so?

I don’t know about this particular issue, but we make heavy use of clustered pub-sub notifications and are seeing no problems with Openfire 4.0.1 (this was reported at 3.9.3)