quality@glassfish.java.net

Re: b65: transactional JMS - number of messages not checked on subsequent calls?

From: matthias.fraass_at_tricoder.net <matthias.fraass_at_gmail.com>
Date: Thu, 1 Oct 2009 15:47:17 +0200

Additional Info:This only occurs with EMBEDDED JMS!
When I set the JMS to local or remote, the behaviour is like v2.1: always
fails correctly.

Another thing - the Admin GUI has a bug:
Configuration -> Java Message Service: Changing the "Type" to EMBEDDED or
REMOTE sets the Type correctly in domain.xml. But after reloading the page,
"LOCAL" is displayed, no matter what is set up in domain.xml.
Should I file a bug for this?

-Matthias


2009/10/1 matthias.fraass_at_tricoder.net <matthias.fraass_at_gmail.com>

> Hi all,
>
> summary: I think that the imq.transaction.producer.maxNumMsgs is only
> checked once after GF start (in the first transaction?) and then never
> again. Only the first call fails, subsequent calls that violate this
> threshold don't fail.
>
> Setup:
> - GF v3 b65
> - JMS Queue "jms/SomeQueue" is configured with "Local" transation support.
> - domains\domain1\imq\instances\imqbroker\props\config.properties ->
> imq.transaction.producer.maxNumMsgs=1000
>
> So I have this restful webservice, which I wrote to check how many messages
> per second GF can produce:
>
> @Stateless
> @Path("/jms")
> public class JMSRestfulWebService
> {
> @GET
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public String putMessage() throws ...
> {
> System.out.println("called putMessage");
>
> javax.jms.Connection connection =
> connectionFactory.createConnection();
> javax.jms.Session session =
> connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
> MessageProducer messageProducer = session.createProducer(queue);
> long start = System.currentTimeMillis();
> int i=0;
> long now=0;
> do
> {
> now = System.currentTimeMillis();
> TextMessage message = session.createTextMessage();
> message.setText("Hello, JMS!");
> messageProducer.send(message);
> i++;
> }
> while ((now-start) < 1000);
>
> return "JMS produced " + i + " messages in 1s";
> }
>
> }
>
> and a consuming MDB:
>
> @MessageDriven(
> activationConfig = { @ActivationConfigProperty(
> propertyName = "destinationType", propertyValue =
> "javax.jms.Queue"
> ) },
> mappedName = "jms/SomeQueue")
> public class SomeMessageDrivenBean implements MessageListener {
> ...
> public void onMessage(Message message) {
> System.out.println("Hey! Someone called me @" +
> System.currentTimeMillis());
> }
>
> }
>
> The JMSRestfulWebService above produces about 4300 messages per second. All
> within one transaction.
> On the first call after GF start via
> http://localhost:8080/webservicetest/jms, I get the error message:
> > "com.sun.messaging.jmq.jmsserver.util.BrokerException: transaction
> failed: [B4303]: The maximum number of messages [1.000] that the producer
> can process in a single transaction (TID=1467650178062093569) has been
> exceeded. Please either limit the # of messages per transaction or increase
> the imq.transaction.producer.maxNumMsgs property."
>
> Which is correct.
>
> But on the second call (and from then on), there's no such message and
> about 4300+ messages are produced and consumed!
> When I restart the sever, the same behavior occurs: first call ->
> exception, second+ call -> no exception.
>
> I double checked the following things:
> - increasing the imq.transaction.producer.maxNumMsgs to 10.000 leads to no
> exception at all, which is correct.
> - I put the test case in a Session Bean with the same results. So it
> doesn't have to do with the RESTful webservice.
> - Glassfish v2.1 works correctly (tested with a SessionBean producing the
> messages): the exception is thrown every time!
>
> So the imq.transaction.producer.maxNumMsgs *is* checked - but only for the
> first transaction?
>
> Best regards,
>
> Matthias