You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by skomarla <sk...@yahoo.com> on 2008/07/28 22:30:43 UTC

Master/Slave JDBC persistence using embedded broker in JBoss

Hello,

I'm having trouble getting a master slave setup working using an embedded
broker in JBoss with JDBC persistence. I've done some searching to see if
there is a workaround, but the only thing i've seen seems to be to either
run master/slave separately, which is what I'm trying to avoid.

The overview of the architecture is this.  
1) There will be multiple JBoss instances each hosting a spring based
application, which contain JMS listeners (using the spring's
org.springframework.jms.listener.DefaultMessageListenerContainer).  
2) In order to keep the deployment as simple as possible, we have decided to
use the embedded activemq broker and have each node use the in vm transport
protocol.
3) I'm using activemq 5.1.0, and so I don't have a problem with the slave
node completing its startup sequence.

My problem occurs when my spring based application deploys.  
- The master node completes its start up sequence and the application
deploys.  
- The slave node complete's startup sequence without blocking, but when the
application deploys, the DefaultMessageListenerContainer repeatedly tries to
connect to the broker.  This fails with the below exception. (seemingly
because the slave has not started its transport connectors which it seems to
only do so when it becomes a master)

2008-07-28 15:51:00,085 WARN 
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable
while attempting to get a new connection: null
javax.resource.ResourceException: Could not create connection.
	at
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:171)
	at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
	at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
	at
org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:538)
	at
org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
	at
org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
	at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
	at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94)
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
	at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$100(AbstractPollingMessageListenerContainer.java:76)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createConnection(AbstractPollingMessageListenerContainer.java:496)
	at
org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:279)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:282)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:237)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:944)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:868)
	at java.lang.Thread.run(Thread.java:595)
Caused by: javax.jms.JMSException: Could not create Transport. Reason:
java.io.IOException: Server TransportAcceptListener is null.
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:250)
	at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:177)
	at
org.apache.activemq.ra.ActiveMQConnectionSupport.makeConnection(ActiveMQConnectionSupport.java:79)
	at
org.apache.activemq.ra.ActiveMQConnectionSupport.makeConnection(ActiveMQConnectionSupport.java:61)
	at
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:169)
	... 18 more
Caused by: java.io.IOException: Server TransportAcceptListener is null.
	at
org.apache.activemq.transport.vm.VMTransportServer.connect(VMTransportServer.java:72)
	at
org.apache.activemq.transport.vm.VMTransportFactory.doCompositeConnect(VMTransportFactory.java:140)
	at
org.apache.activemq.transport.vm.VMTransportFactory.doConnect(VMTransportFactory.java:53)
	at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:47)
	at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:76)
	at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:235)
	... 23 more


My understanding of the embedded broker is that when a broker is a slave, it
will forward all to the master broker.  My goal is to have each jboss node
be in the position to produce messages into a persistent queue and consume
message from the queue without needing to know that they are connected to a
master or slave.

I know that I can specifically list all the brokers using the failover
protocol, but that would seem to negate the benefit of an in-vm protocol. 
My broker-config.xml files are attached.

Any help would be greatly appreciated.

Thank you.
-Sharath

http://www.nabble.com/file/p18698970/broker2.xml broker2.xml 
http://www.nabble.com/file/p18698970/broker1.xml broker1.xml 
-- 
View this message in context: http://www.nabble.com/Master-Slave-JDBC-persistence-using-embedded-broker-in-JBoss-tp18698970p18698970.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Master/Slave JDBC persistence using embedded broker in JBoss

Posted by skomarla <sk...@yahoo.com>.
I did see that but I guess I was hoping for this to be a little more elegant. 
I feel that having to define all the failover URLs defeats the purpose of
in-vm protocol in the case of an embedded master slave.  

It would be have been nice if the in vm broker is started in a "slave" mode,
where it would forward the messages to the master.  Perhaps it was my
misunderstanding of ActiveMQ, but I thought broker discovery would have
helped achive this.  I can't use networked brokers because I want all the
nodes to share the same database.


Hans Bausewein wrote:
> 
> First of all, I'm not sure whether I'm the right person to answer your
> questions.
> There may be more uses of ActiveMQ than I know of.
> 
> I've deployed 5.1.0 and the development version in a clustered JBoss
> environment with pure master/slave and as a single broker (because of some
> issues). 
> 
> 
> skomarla wrote:
>> 
>> Hello,
>> 
>> I'm having trouble getting a master slave setup working using an embedded
>> broker in JBoss with JDBC persistence. I've done some searching to see if
>> there is a workaround, but the only thing i've seen seems to be to either
>> run master/slave separately, which is what I'm trying to avoid.
>> 
>> The overview of the architecture is this.  
>> 1) There will be multiple JBoss instances each hosting a spring based
>> application, which contain JMS listeners (using the spring's
>> org.springframework.jms.listener.DefaultMessageListenerContainer).  
>> 2) In order to keep the deployment as simple as possible, we have decided
>> to use the embedded activemq broker and have each node use the in vm
>> transport protocol.
>> 3) I'm using activemq 5.1.0, and so I don't have a problem with the slave
>> node completing its startup sequence.
>> 
>> My problem occurs when my spring based application deploys.  
>> - The master node completes its start up sequence and the application
>> deploys.  
>> - The slave node complete's startup sequence without blocking, but when
>> the application deploys, the DefaultMessageListenerContainer repeatedly
>> tries to connect to the broker.  This fails with the below exception.
>> (seemingly because the slave has not started its transport connectors
>> which it seems to only do so when it becomes a master)
>> 
> 
> The documentation is quite clear:
> 
>   http://activemq.apache.org/jdbc-master-slave.html
> 
> "Only the master broker starts up its transport connectors and so the
> clients can only connect to the master."
> 
> If you want to know why, one of the designers/developers probably better
> answers that.
> 
> I guess it's a lot easier to accept messages on one entry point only.
> 
> Hans
> 
> 

-- 
View this message in context: http://www.nabble.com/Master-Slave-JDBC-persistence-using-embedded-broker-in-JBoss-tp18698970p18699994.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Master/Slave JDBC persistence using embedded broker in JBoss

Posted by Hans Bausewein <ha...@comerwell.xs4all.nl>.
First of all, I'm not sure whether I'm the right person to answer your
questions.
There may be more uses of ActiveMQ than I know of.

I've deployed 5.1.0 and the development version in a clustered JBoss
environment with pure master/slave and as a single broker (because of some
issues). 


skomarla wrote:
> 
> Hello,
> 
> I'm having trouble getting a master slave setup working using an embedded
> broker in JBoss with JDBC persistence. I've done some searching to see if
> there is a workaround, but the only thing i've seen seems to be to either
> run master/slave separately, which is what I'm trying to avoid.
> 
> The overview of the architecture is this.  
> 1) There will be multiple JBoss instances each hosting a spring based
> application, which contain JMS listeners (using the spring's
> org.springframework.jms.listener.DefaultMessageListenerContainer).  
> 2) In order to keep the deployment as simple as possible, we have decided
> to use the embedded activemq broker and have each node use the in vm
> transport protocol.
> 3) I'm using activemq 5.1.0, and so I don't have a problem with the slave
> node completing its startup sequence.
> 
> My problem occurs when my spring based application deploys.  
> - The master node completes its start up sequence and the application
> deploys.  
> - The slave node complete's startup sequence without blocking, but when
> the application deploys, the DefaultMessageListenerContainer repeatedly
> tries to connect to the broker.  This fails with the below exception.
> (seemingly because the slave has not started its transport connectors
> which it seems to only do so when it becomes a master)
> 

The documentation is quite clear:

  http://activemq.apache.org/jdbc-master-slave.html

"Only the master broker starts up its transport connectors and so the
clients can only connect to the master."

If you want to know why, one of the designers/developers probably better
answers that.

I guess it's a lot easier to accept messages on one entry point only.

Hans

-- 
View this message in context: http://www.nabble.com/Master-Slave-JDBC-persistence-using-embedded-broker-in-JBoss-tp18698970p18699988.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.