I've found the part of the solution. I've set jmsTemplate NON_PERSISTENT delivery mode for all messages that goes through the queue. I've tested for next sequent of events:
- Set values for FullSize/PageSize/DownCacheSize on 1000/100/100 in the destinations-service.xml on the TestQueue
- Sending messages service is stopped
- 3000 messages are sent on the queue
- 1000 messages are placed in the memory
- Remaining 2000 messages are stored into the database
Is there any mechanism that can store these 1000 messages from memory to the database when JBoss server shutdown hook is called (shutdown.sh) ?
Another question, is there some "formula" for the best performance considering relationship between values for FullSize/PageSize/DownCacheSize ?
I've found a kind of solution. When JBoss server starts to shutdown it calls manually created destroy method that receives all messages from memory, set them as persistent and stores them in database. Our final problem is:
I'll take example from previous post. First 1000 messages are in memory, next 2000 are in database. When we shutdown JBoss first 1000 messages are placed after message with id = 3000. So when we start JBoss again in memory will be messages with ids: 1001 to 2000. This is out of order and presents a huge problem to me. I've tried with JMSPriority to give messages that stores while shutting down jboss higher priority, but without effect, because JMSPriority only works when all messages are already in the memory.
In oracle-persistence-service.xml file I've found SQLProperties, and query:
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
I've tried to add ORDER BY PRIORITY DESC, but exception was thrown:
[JDBCSupport] SQLException caught, SQLState 42000 code:933- assuming deadlock detected, try:1 java.sql.SQLException: ORA-00933: SQL command not properly ended
Is there any kind of solution that can sort messages from the database ?
PS. Did I write this topic in the correct forum, because nobody is answering ? Should it be in the JBoss Messaging subsection ?