eclipse-ee4j / openmq

OpenMQ
https://projects.eclipse.org/projects/ee4j.openmq/
Other
52 stars 34 forks source link

Client using mq://localhost/direct not thrown exception when writing to a full queue #95

Open glassfishrobot opened 13 years ago

glassfishrobot commented 13 years ago

This bug reported on the forum at http://forums.oracle.com/forums/thread.jspa?forumID=874&threadID=2228870&messageID=9617861#9617861

This bug relates to the use of an embedded broker with direct mode client, as documented in the Message Queue "Developers Guide for Java Clients", chapter 6 "Embedding a Message Queue Broker in a Java Client".

If a queue has its maximum size defined using the destination property maxNumMsgs (for administratively-created queues) or the broker property imq.autocreate.destination.maxNumMsgs (for auto-created queues), then when that limit is reached, a TCP client receives a com.sun.messaging.jms.ResourceAllocationException (as documented in Table 18-1 "Physical Destination Properties" of the Message Queue Admin Guide). However a direct mode client does not receive any exception. The broker logs an error and rejects the new messages, but no exception is thrown to the client.

This is demonstrated using the attached test case. Before running it, set the broker args on line 81.

The test case as attached uses a TCP connection, and the exception thrown is

com.sun.messaging.jmq.jmsserver.util.BrokerException: [B4120]: Can not store message
14-10.175.12.175(e7:77:6f:2c:9a:97)-3715-1306435265343 on destination curlyQueue [Queue]. 
The destination message count limit (maxNumMsgs) of 100 has been reached.
Exception in thread "main" com.sun.messaging.jms.ResourceAllocationException: [C4096]: Destination is full 
and is rejecting new messages: curlyQueue user=guest, broker=localhost:7676(3711)
    at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writeJMSMessage(ProtocolHandler.java:2001)
    at com.sun.messaging.jmq.jmsclient.WriteChannel.sendWithFlowControl(WriteChannel.java:179)
    at com.sun.messaging.jmq.jmsclient.WriteChannel.writeJMSMessage(WriteChannel.java:132)
    at com.sun.messaging.jmq.jmsclient.SessionImpl.writeJMSMessage(SessionImpl.java:795)
    at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:213)
    at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:202)
    at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.send(MessageProducerImpl.java:689)
    at com.sun.messaging.jmq.jmsclient.QueueSenderImpl.send(QueueSenderImpl.java:128)
    at maxnummsgs.TestClient.main(TestClient.java:47)

Now uncomment line 35 (which sets the imqAddressList property to mq://localhost/direct) and repeat the test. No such exception is thrown.

Affected Versions

[4.5]

glassfishrobot commented 6 years ago
glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by @nigeldeakin

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: TestClient.java Attached By: @nigeldeakin

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA MQ-95