I am running 2 Openfire nodes in a cluster environment.
Openfire version:- 4.4.2
Hazelcast version:- 2.4.2
I have set the property xmpp.muc.history.reload.limit to 365.
I have 2 chat rooms(CR1, CR2) in my openfire. Both rooms have chat messages in the database. CR1 chat room is 2 months older and the CR2 chat room is 2 days older. CR1 chat room doesn’t have any activity from the last 50 days.
Now I try to access a chat history of CR2, it shows all chat messages. but when I am doing the same with the CR1 chat room it doesn’t show any chat history.
If I work with a single node openfire then CR2(60 days older chat room) chat history loaded successfully but when I work with cluster environment(two Openfire nodes) then it doesn’t provide me chat history.
I suspect, loading chat history(rooms which are not active from the last 30 days) issue is with cluster environment.
I debug the Openfire source code and found that, on openfire startup, chat histories are being cached for those rooms which are active from the last 30 days. and chat rooms whose history not cached are being loaded later when the user trying to access the chat room.
MUCPersistenceManager.java line no 172
// Reload the history, using "muc.history.reload.limit" (days); defaults to 2 int reloadLimitDays = JiveGlobals.getIntProperty(MUC_HISTORY_RELOAD_LIMIT, 2); long from = System.currentTimeMillis() - (BigInteger.valueOf(86400000).multiply(BigInteger.valueOf(reloadLimitDays))).longValue(); pstmt.setString(1, StringUtils.dateToMillis(new Date(from))); pstmt.setLong(2, room.getID()); rs = pstmt.executeQuery();
Here I found, default number of days to load chat history is 2 so i have added xmpp.muc.history.reload.limit to 365.
Chat history is being loaded for a single openfire node but not with 2 clustered openfire nodes.
Please help me with this !!