You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by a_schulle <al...@solutionary.de> on 2012/08/07 16:12:05 UTC

Broker stops after loosing database connection

We are using Version 5.6.0 in an "JDBC Master Slave" configuration.
In the case that the master looses the connection to the database it stops
the broker. This is the part of JDBCPersistenceAdapter where it happens:

...
    protected void databaseLockKeepAlive() {
        boolean stop = false;
        try {
            DatabaseLocker locker = getDatabaseLocker();
            if (locker != null) {
                if (!locker.keepAlive()) {
                    stop = true;
                }
            }
        } catch (IOException e) {
            LOG.error("Failed to get database when trying keepalive: " + e,
e);
        }
        if (stop) {
            stopBroker();
        }
    }

    protected void stopBroker() {
        // we can no longer keep the lock so lets fail
        LOG.info("No longer able to keep the exclusive lock so giving up
being a master");
        try {
            brokerService.stop();
        } catch (Exception e) {
            LOG.warn("Failure occurred while stopping broker");
        }
    }
...

This behavior was a little unespected to us. The consequence is that this
instance have to be restartet when the network connection comes up again.

It would be nice if such a broker would try to reestablish the connection to
the database and after reconnect becomming a slave. Is there a way to
configure ActiveMQ like this?

I would appreciate any help. Thanks!
Alex



--
View this message in context: http://activemq.2283324.n4.nabble.com/Broker-stops-after-loosing-database-connection-tp4654845.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Broker stops after loosing database connection

Posted by Gary Tully <ga...@gmail.com>.
have a look at https://issues.apache.org/jira/browse/AMQ-3654 when
jira comes back on line.

On 7 August 2012 15:12, a_schulle <al...@solutionary.de> wrote:
> We are using Version 5.6.0 in an "JDBC Master Slave" configuration.
> In the case that the master looses the connection to the database it stops
> the broker. This is the part of JDBCPersistenceAdapter where it happens:
>
> ...
>     protected void databaseLockKeepAlive() {
>         boolean stop = false;
>         try {
>             DatabaseLocker locker = getDatabaseLocker();
>             if (locker != null) {
>                 if (!locker.keepAlive()) {
>                     stop = true;
>                 }
>             }
>         } catch (IOException e) {
>             LOG.error("Failed to get database when trying keepalive: " + e,
> e);
>         }
>         if (stop) {
>             stopBroker();
>         }
>     }
>
>     protected void stopBroker() {
>         // we can no longer keep the lock so lets fail
>         LOG.info("No longer able to keep the exclusive lock so giving up
> being a master");
>         try {
>             brokerService.stop();
>         } catch (Exception e) {
>             LOG.warn("Failure occurred while stopping broker");
>         }
>     }
> ...
>
> This behavior was a little unespected to us. The consequence is that this
> instance have to be restartet when the network connection comes up again.
>
> It would be nice if such a broker would try to reestablish the connection to
> the database and after reconnect becomming a slave. Is there a way to
> configure ActiveMQ like this?
>
> I would appreciate any help. Thanks!
> Alex
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Broker-stops-after-loosing-database-connection-tp4654845.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com