What I am wondering is why I do not get all the chat room messages when I join the room. I seem to only get recent ones! For example, when I look in the database in the MUCCONVERSATIONLOG table I have 24 messages in a specific room, but when I join the room, or use MultiUserChat.nextMessage(100) to get the history, I only get 3 (the most recent, which is in the db). Is there a time limit on the server only returning messages within a certain time frame? Am I only getting the messages in the cache? If so, how many messages can be stored in the cache for a specific room? Where is the cache located and when is it cleared? Any help would be much appreciated!
I tried to reproduce this problem using Openfire 3.5 RC (and also future Openfire 3.6 ) and Exodus as my client and it worked just fine. I configured the History Settings to Show Entire Chat History and created a room and made it persistent and log conversation. A user joined the room and sent 60 messages. I restarted the server and joined the room using another user. The new user received the 60 messages.
I would recommend updating to the latest version of OF and see if you are still having this issue. Also make sure that this is not a client problem.
In the MUCROOM table I noticed that the EMPTYDATE column is being updated and that I don’t seem to get any messages when I go into a room if the message’s time stamp is prior to the time in the room’s EMPTYDATE column. When is this column updated and what is the catalyst, because initially this column is null for a newly created room.
Not sure if this would be of any help. I however was just browsing through the chat service properties in the admin console of OpenFire and there I found two options controlling the storage of conversations in a chat.
There is an option that controls a Flush interval which defaults to 300 seconds. And there is an option that controls the batch size which defaults to 50.
This might also cause messages to be removed from the history.
pstmt = con.prepareStatement(LOAD_HISTORY);
// Recreate the history until two days ago
long from = System.currentTimeMillis() - (86400000 * 2);
pstmt.setString(1, StringUtils.dateToMillis(new Date(from)));
pstmt.setLong(2, room.getID());
rs = pstmt.executeQuery();
This was discussed already in http://www.igniterealtime.org/community/message/184940 but it seems that no one did notice this rather old thread. I did update JM-294 issue to link to both threads - hopefully this issue will get solved soon.