You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Klaus.Unger" <kl...@iq-consultancy.net> on 2011/09/20 20:00:53 UTC

Shared Database Master/Slave config throws JMSException when aborting Master

Hello,

I have a scenario (Spring, ActiveMQ, PostgreSQL) where we want to configure
our messaging to provide automatic failover and no additional interaction on
bringing a failed master back online (like in pure-shared-nothing
master/slave).

as mentioned in ActiveMQ in action I just started multiple brokers using the
same configuration - besides the SQL Warnings that the tables in the
PostgreSQL DB already exists, everythings works fine.

I start an integrationtest, which sends a couple of thousand simple messages
to the broker(s). 

when I kill the master in charge, the failover takes perfectly place: 

14184   WARN   transport.failover.FailoverTransport Transport
(localhost/127.0.0.1:61616) failed to tcp://localhost:61616 , attempting to
automatically reconnect due to: java.io.EOFException
14552   INFO   transport.failover.FailoverTransport Successfully reconnected
to tcp://localhost:61616

so far so good, but immediately after I receive the following:

14607   WARN   jms.connection.CachingConnectionFactory Encountered a
JMSException - resetting the underlying JMS Connection
javax.jms.JMSException: The subscription does not exist:
ID:iQ-MacBook-Pro-15.local-58766-1316540825439-0:1:1:37
...

Caused by: java.lang.IllegalArgumentException: The subscription does not
exist: ID:iQ-MacBook-Pro-15.local-58766-1316540825439-0:1:1:37
	at
org.apache.activemq.broker.region.AbstractRegion.messagePull(AbstractRegion.java:389)
...

my re-used broker config looks like this:

  <broker useJmx="false" brokerName="jdbcBroker"
xmlns="http://activemq.apache.org/schema/core">
    <persistenceAdapter>
       <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data"
dataSource="#postgres-ds"/>
    </persistenceAdapter>

    <transportConnectors>
       <transportConnector name="default" uri="tcp://0.0.0.0:61617"/>
    </transportConnectors>
  </broker>
 
    <bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">
        <property name="serverName" value="localhost"/>
        <property name="databaseName" value="activemq"/>
        <property name="portNumber" value="0"/>
        <property name="user" value="activemq"/>
        <property name="password" value="activemq"/>
        <property name="dataSourceName" value="postgres"/>
        <property name="initialConnections" value="1"/>
        <property name="maxConnections" value="10"/>
    </bean>

my spring config looks like:

  <bean id="amqConnectionFactory"
class="org.apache.activemq.spring.ActiveMQConnectionFactory"
    p:brokerURL="${jms.brokerUrl}"
    p:clientIDPrefix="${jms.clientIDPrefix}" />

  <bean id="jmsConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory"
	p:targetConnectionFactory-ref="amqConnectionFactory" 
    p:sessionCacheSize="${jms.sessionCacheSize}" 
    p:reconnectOnException="true"
    p:exceptionListener-ref="jmsExceptionListener" />


I've searched almost the whole day now, but didn't come to any conclusion!
Any help, hints, ... very appreciated!

thx
K:)



--
View this message in context: http://activemq.2283324.n4.nabble.com/Shared-Database-Master-Slave-config-throws-JMSException-when-aborting-Master-tp3827666p3827666.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.