• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Delete Messages from Jboss Queue during jboss shut down?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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.
@Service
@Management(ServiceOneManagement.class)

void create() throws Exception;

Can we use void destroy(); method to delete the messages?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Possible kludge: add to the run script a call to another script that deletes the messaging tables from the database. Then when JBoss AS starts up, messaging will create new, empty tables.
 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Johnson,

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.

Thanks & Regards,
Chethan
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic