SourceForge has been redesigned. Learn more.

Setting up a distributed chat

  • Maarten van Hoof

    This message I wrote in response to the "Simple JMS Provider" thread in this forum and the "Testing JMS" thread in the Open Discussion forum, but I decided to create a new thread for it.

    Hi Silas,

    Its good to see somebody take an interest in the distributed chat. This feature has been in NFC since very early versions, but we have very little information about how much it has been used. It certainly is not very well documented, so don't apologise for not understanding it.

    When the distributed stuff was written we needed a JMS implementation and went with SwiftMQ. SwiftMQ was free software, but not open source. It was free up to version 2.1 or something, today you must pay for it.

    Here's the theory. You start a JMS server somewhere. You tell NFC about it by setting jms.enabled=true in the configuration file. For NFC to set up a connection to the JMS server, it needs an Initial Context Factory (an implementation-specific class that must be on the classpath) and a URL to connect to. Once NFC has established the connection it will login using a username and password and subsequently register with a JMS topic. The JMS server must accept the login and the topic.
    Now you configure and start another NFC server on some other machine (or the same, but make sure it's on another port). It too will connect to the JMS server and so the two NFC servers will meet each other and talk on the subject of NFC. Voila, a distributed network of NFC servers.

    Now here's how it worked using SwiftMQ: You get the SwiftMQ jar file (I'll get to this in a minute) and put it in the lib directory of your NFC distribution (or any other directory on your filesystem). Then you edit runServer.bat (Windows) or (Linux) and set JMS_IMPL (JMS in to the full path of the SwiftMQ jar. Then you set jms.enabled=true in the configuration file and leave the other jms values unchanged. Then you configure your SwiftMQ server to run on localhost on port 4001 (the default) and you tell it to create topic nfc. You could instruct it to require a username and password, in which case you'd have to uncomment the coresponding values in the configuarion file. Now you start NFC. Look in the log files for errors. There shouldn't be any. Repeat this process for another NFC. See if the two NFC's find eachother.

    Note that you would use one JMS server and two NFC servers. Note that these would theoretically all be on different machines. Note that in that case you would have to change the URL of the JMS server in the NFC configuration files. Note that the JMS could be on the same machine as one of the NFC servers. Note that if you want to test the whole setup on a single machine, you must also configure the second NFC to use a different port than the first one.

    Note that SwiftMQ is no longer free. You should find out if you can still download version 2.1 or something off their website ( If you can not, you'll have to find some other JMS implementation. The only one I know of is OpenJMS and I do not even know if that is still alive (although I imagine it would be). It should be pretty transparent: if all is well you only need to change the jar files and the jndi.initial and jms.provider keys in the configuration file.

    If you cannot get it to work, see what the log files say. Take a look at the Distributer class ( to see how stuff is implemented. Please keep us informed of what you are doing, especially if you'r going to try a different JMS implementation. Ask any questions you have here, but keep in mind that I will have limited time to answer them. Do not ask me stuff about how to configure SwiftMQ or some other JMS implementation, read the JMS implementation's manual.

    Good luck,


    • Silas

      Silas - 2003-11-07

      THANKS! I am currently trying to set up openjms, I will keep you posted,



Log in to post a comment.