Multiple Tigase servers launched by one JVM
Hi everybody
I try to setup a monitoring network without any centralized infrastructure. I plan to use XMPP as the primary comunication protocol to organize the independent nodes.
In order to run unit tests simulating multiple machines on the same server I have to setup multiple independend instances of the tigase server on the same box (different sockets of course).
Currently I am using the XMPPServer.main(..) call to startup the server.
I have a couple of questions concerning having multiple servers running at the same time.
- Is it possible to run multiple instances of the same server in the same JVM (different threads and sockets of course) while sharing all config files (eg. user-repository.xml)
- How do I vary the port when starting up the server? Is there an undocumented commandline switch which I can use to vary the port or do I have to vary the config file? Is maybe another API call better suitable to start a server when started by a java application?
- How do I shutdown gracefully a thread running tigase server (preferably by an api call not an XMPP message)? (I am not interested in something ugly such as Thread.stop())
- Where do I report bugs (from time to time i get java exceptions on the console)
Thanks for any suggestion/answer in advance
Regards
Martin
Trackback URL for this post:
- Add new comment
- 912 reads






As I mentioned earlier I am going to rewrite this part. And the design is already ready.
I am not offended at all, this is very valid point. I don't like this part of Tigase code. Similar functionality - run-time configuration is also implemented in
tigase.server.sreceiverpackage but this package is implemented in right way so new Configurator will be based in this code.OK ... I managed to setup different ports at runtime but this piece of code could definitely use some attention.
Just out of interest: Do you plan to replace this rather central part of the code by something .... prettier (no offence ment but I can see here a couple of dangers [keyword:thread safety])
Regards
Martin
Hello, you are doing "strange" things to Tigase ;-)
The bad news is that Configurator class is the most messy code in the whole Tigase project. This is the place where ideas are usually get formed.
There is also no well established API for manipulating configuration the way you do. The good news is that I have an idea how to improve it and this work is scheduled for near future.
In mean time I would suggest to you to look in code of 2 methods:
public void setup(String name)andpublic void setup(Configurable component). That should give you an idea how to manipulate and change component configuration at runtime.The line:
Map<String, Object> prop = repository.getProperties(compId);is the key. Print out content of this Map and then you will see what settings to modify. Probably just replace all occurrences of 5222 with your port number.propMap is exactly what Component accepts as a configuration parameters.The only problem you might have is that values are Objects and they don't usually map directly to String. Look in tigase XML config file to see what is the real type of particular parameter.
And the last suggestion: configuration details guide might help you understand what is going on.
If you have any more problems, don't hesitate to ask...
OK
I am creating a Configurator like this
<snip>
String initialConfig =".level=ALL\n"+
"handlers=java.util.logging.ConsoleHandler\n"+
"java.util.logging.ConsoleHandler.formatter=tigase.util.LogFormatter\n";
Configurator.loadLogManagerConfig(initialConfig);
config = new Configurator(configFile, new String[0]);
</snip>
When changing the port I have either
Any help would be apreciated.
Yes, all this is possible and should be quite easy achievable.
Damit ... This piece of code (yes ... I am talking about the server) is really good.
In other words you mean I can ...
Is that correct or did I miss something?
Regards
Martin
Let me answer your questions starting from the simplest:
1. The best place to report bugs is our bug tracker: Trac alternatively you can report bugs or any problem here on this forum.
All other questions require some basic understanding of Tigase server architecture. I will explain it briefly here but I recommend to download presentation of the server architecture: Tigase presentation.
Basically everything in Tigase is a component. You can load and stop components at runtime. You can load as many components as you like each of them may use different port numbers.
The basic component is:
MessageRouter. It doesn't use and TCP/IP ports. It just takes care of data packets to forward them from source address to destination address. You can have only one such component active for each Tigase server instance.MessageRoutercan load, unload, start and stop all other components:There are also a few different components specialized to send big number of stanzas taken from database for example or for distributing messages to many users, just like mailing list.
I would recommend to read first basic information about API and then a little more about configuration.
Going back to your questions. Everything is possible but there are many ways to do this and selecting the best way depends on particular case.
I mean either I should know more details to recommend something or you should know more about Tigase to choose something.