no

Learn to Persist Jms Message in a Database in Glassfish

This tutorial will guide you on how to configure Java Messaging Service in Glassfish to store JMS message in a postgresql database. What y...

This tutorial will guide you on how to configure Java Messaging Service in Glassfish to store JMS message in a postgresql database.

What you need (configured and running):
1.) Glassfish 3.1.2.2
2.) Postgresql 9.1
3.) JMS Broker (integrated with Glassfish) set to LOCAL

Steps:
1.) Configure JMS property to persist JMS message in database by adding the following properties inside Glassfish admin, normally http://localhost:4848, go to Configurations->server-config->Java Message Service->


imq.persist.jdbc.postgresql.driver=org.postgresql.Driver
imq.instanceconfig.version=300
imq.persist.jdbc.postgresql.closedburl=jdbc\:postgresql\://localhost\:5432/ipieljms
imq.persist.jdbc.dbVendor=postgresql
imq.brokerid=ipiel
imq.jmsra.managed=true
imq.autocreate.reaptime=1
imq.persist.jdbc.postgresql.opendburl=jdbc\:postgresql\://localhost\:5432/ipieljms
imq.persist.jdbc.postgresql.needpassword=true
imq.persist.store=jdbc
imq.persist.jdbc.postgresql.password=ipiel
imq.persist.jdbc.postgresql.user=ipiel



*Don't forget to set JMS Service Type=LOCAL, in the same screen.

2.) Lastly don't forget to specify to JMS Broker, where the postgresql driver is located by modifying the file: /glassfish-3.1.2.2/mq/etc/imqenv.conf, and adding the line:

IMQ_DEFAULT_EXT_JARS=/glassfish-3.1.2.2/glassfish/domains/domain1/lib/postgresql-9.0-802.jdbc4.jar

Or where your postgresql jdbc jar is.

3.) Make sure that you have ipieljms schema in postgresql and user ipiel/ipiel has access to it.

4.) Restart Glassfish and after that you will notice that tables are created in ipieljms schema.

5.) You can now start sending your JMS message :-)

Related

javaee 7703846818640779561

Post a Comment Default Comments

item