Hello all, I'm implementing ActiveMQ in Spring environment and using Jencks for consumer as a listener. Performance for 6000 messages sent in one time is 47msg/sec... but when testing ActiveMQ with simple java class I get about 3k msg/sec. Whats the problem? can anybody help me? anyway my testing platform is notebook with dual core 1.7GHz and 1.5GB memory. Please refer to my code below.
My Producer code : public class ProducerAndListener { public static String Producer(String input) throws JMSException { boolean jmsSuccess = false; boolean isJMSException = false; javax.jms.Connection connection = null; javax.jms.Session session = null; while(!jmsSuccess) { try { org.apache.activemq.ActiveMQConnectionFactory connectionFactory = new org.apache.activemq.ActiveMQConnectionFactory( "tcp://localhost:61616?jms.prefetchPolicy.all=100" ); connectionFactory.setUseAsyncSend(true); // This is the magic words "+connectionFactory.getBrokerURL()); //connectionFactory.setBrokerURL("tcp://192.168.1.137:61616"); connection = connectionFactory.createConnection(); session = connection.createSession( false, javax.jms.Session.AUTO_ACKNOWLEDGE ); javax.jms.Destination destination = session.createQueue( "sminderQueue" ); javax.jms.MessageProducer producer = session.createProducer( destination ); producer.setDeliveryMode( javax.jms.DeliveryMode.PERSISTENT ); connection.start(); javax.jms.TextMessage message = session.createTextMessage(); message.setText(input); producer.send( message ); jmsSuccess = true; } catch ( javax.jms.JMSException je) { if (!isJMSException) isJMSException = true; System.out.println("[ERROR][1] the jms error: "+je.toString()); } catch ( Exception eOuter ) { if (!isJMSException) System.out.println("[ERROR][3] the other error: "+eOuter.toString()); } } try { if ( session != null ) session.close(); if ( connection != null ) connection.close(); } catch ( Exception eInner ) { eInner.printStackTrace(); } return ("Sukses"); } } My Consumer code : public class MessageConsumer implements MessageListener { public MessageConsumer() { } public synchronized void onMessage(Message message) { String contentSMS = ""; TextMessage textMessage = (TextMessage)message; System.out.println("####the content: "+textMessage); } } Spring Bean Conf : <bean id="messageConsumer" class="com.trendcom.app.sminder.webapp.jms.MessageConsumer" autowire="byName"/> <bean id="transactionManager" class="org.jencks.factory.TransactionManagerFactoryBean" singleton="true"/> <bean id="jencks" class="org.jencks.JCAContainer"> <property name="transactionManager" ref="transactionManager"/> <property name="threadPoolSize" value="25"/> <!-- the JCA Resource Adapter --> <property name="resourceAdapter"> <bean id="activeMQResourceAdapter" class="org.apache.activemq.ra.ActiveMQResourceAdapter"> <property name="serverUrl" value="tcp://localhost:61616"/> </bean> </property> </bean> <bean id="inboundConnectorA" class="org.jencks.JCAConnector"> <property name="jcaContainer" ref="jencks" /> <!-- subscription details --> <property name="activationSpec"> <bean class="org.apache.activemq.ra.ActiveMQActivationSpec"> <property name="destination" value="sminderQueue"/> <property name="destinationType" value="javax.jms.Queue"/> <property name="maxSessions" value="100"/> <property name="maxMessagesPerSessions" value="100"/> </bean> </property> <property name="ref" value="messageConsumer"/> </bean> Many thanks... -- View this message in context: http://www.nabble.com/ActiveMQ-%2B-Jencks-Performance-tp14249994s2354p14249994.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.