Server to Server PubSub not behaving as expected

Hi,

I am trying to set up PubSub communications between two test servers on the local LAN and I am having trouble. I would appreciate it if someone could point me in the right direction.

The situation so far -

I have 2 Ubuntu servers running Openfire 3.10.2 on the office LAN, they can ping each other and have each other’s hostnames in their /etc/hosts file and can resolve correctly.

I am able to set up chat clients (Psi) so that user1@serverA and user2@serverB can chat correctly.

I have written a test Java class (using Smack 4.1.3) that emulates simple chat between the same two users which works.

As for the PubSub tests, I have successfully (using java/smack) connected to the PubSub service on pubsub.ServerA and created new topics. I have successfully posted and received topic updates when subscribed with users registered on ServerA.

The problem occurs when trying to subscribe with users registered on ServerB, I am able to connect and subscribe without issue, and these users receive the last message posted to the topic straightaway. However, they do not receive subsequent messages as happens when a ‘local’ user is registered.

There appear to be no errors in the XML streams or in the openfire logs, and the remote server sessions are showing up on the admin consoles of both servers. I have also tried to subscribe to the topics using Psi but this shows as Offline all the time (not sure if that facility even works).

Is there something I have missed out in the subscribe class that is preventing it from receiving remote updates?

Many thanks

Shaun

Relevant code:

in publish.java - subscribe user1@ServerA to pubsub.ServerA and post messages to topic

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder(); String username = "user1";
String svc = "ServerA";
String host = svc; configBuilder.setUsernameAndPassword(username + "@" + svc, "password");
configBuilder.setResource("SPClientTest");
configBuilder.setServiceName(svc);
configBuilder.setHost(host);
configBuilder.setDebuggerEnabled(true); TLSUtils.acceptAllCertificates(configBuilder); // using self-signed certs connection = new XMPPTCPConnection(configBuilder.build());
connection.setPacketReplyTimeout(10000);
connection.connect(); // Connect to the server
connection.login(); // Log into the server PubSubManager mgr = new PubSubManager(connection, "pubsub.ServerA");
Node n = mgr.getNode("SPTestTopic"); System.out.println("go..."); String line;
Scanner stdin = new Scanner(System.in);
while(stdin.hasNextLine() && !( line = stdin.nextLine() ).equals( "" )) {
  SimplePayload payload = new SimplePayload("","", "<a>" + line + "</a>");
  PayloadItem payloadItem = new PayloadItem(null, payload);
  ((LeafNode)n).publish(payloadItem);
}
stdin.close();

in subscribe.java - subscribe user2@ServerB to **pubsub.ServerA **and wait for updates on topic (works if using eg: user3@ServerA)

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder(); String username = "user2";
String svc = "ServerB";
String host = svc; configBuilder.setUsernameAndPassword(username + "@" + svc, "password");
configBuilder.setResource("SPClientTest");
configBuilder.setServiceName(svc);
configBuilder.setHost(host);
configBuilder.setDebuggerEnabled(true); TLSUtils.acceptAllCertificates(configBuilder); connection = new XMPPTCPConnection(configBuilder.build());
connection.setPacketReplyTimeout(10000);
connection.connect(); // Connect to the server
connection.login(); // Log into the server PubSubManager mgr = new PubSubManager(connection, "pubsub.ServerA");
Node n = mgr.getNode("SPTestTopic");
n.addItemEventListener(new ItemEventListener() {
  @Override
  public void handlePublishedItems(ItemPublishEvent e) {
    List<Item> items = e.getItems();
    items.stream().forEach(itm -> System.out.println(e.getNodeId() + "--> " + itm.toXML()));
  }
});
Subscription substate = n.subscribe(connection.getUser()); boolean isRunning = true;
while (isRunning) {
  Thread.sleep(50);
}

Moved to “Openfire Support” as it’s likely more an server/pubsub component issue.

Further information on this - I have been able to set up two simple ejabberd servers and try the same tests - this worked as expected, so it going to be something incorrect in the Openfire setup.

Any ideas would be helpful!

Thanks