This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In our application we are using Jboss Message Queue and the MDB's for message processing .
We have a requirement like when jboss shuts down the messages should be deleted from the queue so that next time when jboss starts there should not be any old messages in the queue. Is there any configuartion in jboss ?
Please suggest me the way in which i can do this?
If no configuartions present then please suggest me whether we can do it using EJB @Service destroy method?
We are using EJB Services for instantiating MDB's by pushing some dummy messages.
void create() throws Exception;
Can we use void destroy(); method to delete the messages?
Thanks for the reply.. Could you please let me know the database and the table details from which i can delete the messages.
I have some basic idea like that Jboss MQ uses HSQL DB for storing messages.
So if possible please suggest me the table and database name details.
So are still using HSQLDB for messaging? Are you storing anything else in that database? If not, simply delete the server/default/data directory - that directory contains the persisted database contents used by HSQLDB. So deleting the directory will remove all of the messages.
By the way, I hope that you are not using this system in production - using HSQLDB in production is not recommended because you can lose messages if there is problem (such as a power loss or JVM crash).
Joined: Mar 07, 2011
Thanks Johnson for your valuable reponse. Now its working fine.
When i deleted the data folder from jboss it gave "java.sql.SQLException: length must be specified in type definition: VARBINARY" exception.
I found the solution from net and I am attaching the same below so that it will be useful for others.
- Open the JBOSS_HOME/server/< servername>/conf/standardjbosscmp-jdbc.xml in a text editor
- Search for the "Hypersonic SQL" type-mappping in that file. It will look something like this:
Try changing it to:
Question: But i did not understand what is VARBINARY and why its changed to 1024.