Configure your connection-factory object as follows:
imqobjmgr add -t cf -l "cn=myConnectionFactory" \ -o "imqAddressList=mq://jpgserv/jms" \ -o "imqReconnect=true" \ -o "imqReconnectAttempts=10" -j "java.naming.factory.initial = com.sun.jndi.fscontext.RefFSContextFactory -j "java.naming.provider.url= file:///home/foo/imq_admin_objects" |
This command creates a connection-factory object with a single address in the broker address list. If connection fails, the client runtime will try to reconnect with the broker 10 times. If an attempt to reconnect fails, the client runtime will sleep for three seconds (the default value for the imqReconnectInterval attribute) before trying again. After 10 unsuccessful attempts, the application will receive a JMSException .
You can ensure that the broker starts automatically at system start-up time. See Starting Brokers Automatically in Sun Java System Message Queue 4.2 Administration Guide for information on how to configure automatic broker start-up. For example, on the Solaris platform, you can use /etc/rc.d scripts.