Sure.
>From one client I send 100'000 messages in the queue.
Then on the same machine than the one the broker is launched I have the
following JUnit Test:
@Before
public void setUp() throws Exception {
try{
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://localhost:61616");
connection = connectionFactory.createConnection();
connection.setClientID("tests");
connection.start();
} catch (Exception e) {
e.printStackTrace();
}
}
@After
public void tearDown() throws Exception {
try {
if (connection != null) connection.close();
} catch (Exception e) {
System.err.println("AMQConnection.close: " + e.toString());
}
}
@Test
public void testAsynchronousReceiving() {
try {
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination d = session.createQueue(defaultQueueName);
MsgConsumer textListener = new MsgConsumer();
MessageConsumer consumer = session.createConsumer(d);
System.out.println("Asynchronous receiving started.");
consumer.setMessageListener(textListener);
textListener.waitTillDone();
consumer.close();
session.close();
} catch (JMSException e) {
e.printStackTrace();
} finally {
if (connection != null) {
try {
connection.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
assertTrue(true);
}
The weird thing is that I see nothing in the database:
mysql> select COUNT(*) from activemq_acks;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.01 sec)
mysql> select COUNT(*) from activemq_msgs;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
I set the maxConnection in the DataSource, so mySQL does not complain
anymore, but ActiveMQ is still blocked and try to open more and more
connections.
Thanks.
Adrian Co wrote:
>
> Hi,
>
> I wonder if you can submit a JUnit test case for this? :)
>
> F-kris wrote:
>> Hi,
>>
>> I am using ActiveMQ 4.1 and mySQL 5. I use persistence messaging :
>>
>> <persistenceAdapter>
>> <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
>> dataSource="#mysql-ds" useJournal="true">
>> <adapter><bytesJDBCAdapter/></adapter>
>> </journaledJDBC>
>> </persistenceAdapter>
>>
>> When I want to consume one message with only one consumer, I see hundreds
>> of
>> connections to the mySQL server, and an exception is thrown while trying
>> to
>> consume messages :
>>
>> Exception caught: javax.jms.JMSException: java.io.IOException: Failed to
>> broker message: ID: xxxx-xxx-xxxx-x:x:x:x:x in container:
>> java.io.IOException: Data source rejected establishment of connection,
>> message from server: "Too many connections"
>> javax.jms.JMSException: java.io.IOException: Failed to broker message:
>> ID:xxxx-xxx-xxxx-x:x:x:x:x in container: java.io.IOException: Data source
>> rejected establishment of connection, message from server: "Too many
>> connections"
>> at
>> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:45)
>> at
>> org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1118)
>> at
>> org.apache.activemq.ActiveMQSession.syncSendPacket(ActiveMQSession.java:1667)
>> at
>> org.apache.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:196)
>> at
>> org.apache.activemq.ActiveMQSession.createConsumer(ActiveMQSession.java:840)
>> at org.apache.
>>
>> Does anyone know why?
>>
>>
>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/mySQL-Too-many-connections-tf2185760.html#a6088246
Sent from the ActiveMQ - User forum at Nabble.com.