[jboss-user] [JBoss Messaging] - Re: help on JmsXA
mattlf
do-not-reply at jboss.com
Mon Jun 30 17:44:18 EDT 2008
Clebert
Thank you for your response
In jboss-4.2.2.GA/server/messaging/deploy/jms-ds.xml , I set
<use-java-context>false</use-java-context>
and i was able to successfully use JmsXA
However
1. Enqueuing 100 messages with the implementation that i posted at the root of this thread-post takes 6 seconds
2. I also used JmsTemplate with JmsXA and got the same results
3. Then following your advice, i implemented the following and it took 7 seconds to enqueue messages (enqueuing loop below)
So i am concerned about the performance which are not in line with
http://www.jboss.org/file-access/default/members/jbossmessaging/freezone/docs/userguide-2.0.0.alpha1/html/performance.html
Am i doing something wrong? Where can look into to investigate the problem? Thanks a lot for your advice
| public class JMSProvider {
|
| private InitialContext ic = null;
| private ConnectionFactory connectionFactory = null;
| private Queue queue = null;
| private Connection connection = null;
| private Session session = null;
| private MessageProducer messageProducer = null;
|
| public JMSProvider() throws JMSException, NamingException
| {
| ic = new InitialContext();
| connectionFactory = (ConnectionFactory)ic.lookup("/ConnectionFactory");
| queue = (Queue)ic.lookup("queue/D");
| connection = connectionFactory.createConnection();
| session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
| messageProducer = session.createProducer(queue);
| }
|
| public void simpleSend(final User user)
| {
|
| try
| {
|
| ObjectMessage msg = session.createObjectMessage(user);
| messageProducer.send(msg);
|
| }
| catch(JMSException e)
| {
|
| }
| }
|
| public void destroy() throws JMSException
| {
| messageProducer.close();
| session.close();
| connection.close();
| }
|
|
|
| }
|
| public class JmsTestServlet extends HttpServlet {
|
| private final Log logger = LogFactory.getLog(JmsTestServlet.class);
|
| /**
| *
| */
| private static final long serialVersionUID = -7696232061073152339L;
|
| @Override
| protected void doGet(HttpServletRequest req, HttpServletResponse resp)
| throws ServletException, IOException {
|
| WebApplicationContext context = WebApplicationContextUtils
| .getWebApplicationContext(this.getServletContext());
|
| final JMSProvider provider = (JMSProvider) context
| .getBean("jmsProvider");
|
| int perf = 100;
|
| Calendar startTime = Calendar.getInstance();
| for (int i = 0; i < perf; i++) {
|
| User user = new User();
| user.setId(new Long(i));
| user.setFirstName("first_" + i);
| user.setLastName("last_" + i);
|
| provider.simpleSend(user);
|
| }
| Calendar endTime = Calendar.getInstance();
| long millisec = endTime.getTimeInMillis() - startTime.getTimeInMillis();
| logger.info(perf+" messages sent in " + millisec + " milliseconds");
|
| }
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161616#4161616
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4161616
More information about the jboss-user
mailing list