-
Bug
-
Resolution: Done
-
Major
-
JBoss A-MQ 6.0
-
None
-
None
Message is sent using new connection, session (CLIENT_ACKNOWLEDGE mode) and sender, then received by receiver, not acknowledged.Then different connection is used, new session, receiver, message is not received even if it should be still in the queue.Test method from TCKs:/*@testName: closedQueueConnectionNoForcedAckTest
*@assertion_ids: JMS:JAVADOC:272; JMS:SPEC:105; JMS:JAVADOC:429; JMS:SPEC:115;
*@test_Strategy: Send and receive single message, don't acknowledge it.close the queue connection, get the message with a secondconnection.
*/public void closedQueueConnectionNoForcedAckTest() throws Fault {
boolean pass = true;try {
TextMessage messageSent = null;
TextMessage messageReceived = null;
QueueSession qSession = null;
QueueReceiver qReceiver = null;
QueueSender qSender = null;// set up test tool for Queue
tool = new JmsTool(JmsTool.QUEUE, user, password);QueueConnection newConn = (QueueConnection)tool.getNewConnection(JmsTool.QUEUE, user, password);
connections.add(newConn);qSession = newConn.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
tool.getDefaultQueueReceiver().close();
tool.getDefaultQueueSession().close();qReceiver = qSession.createReceiver(tool.getDefaultQueue());
qSender = qSession.createSender(tool.getDefaultQueue());
TestUtil.logMsg("create a new connection");
newConn.start();TestUtil.logMsg("Creating 1 TextMessage");
messageSent = qSession.createTextMessage();
messageSent.setText("just a test");
messageSent.setStringProperty("COM_SUN_JMS_TESTNAME",
"closedQueueConnectionNoForcedAckTest");
TestUtil.logMsg("Sending a TextMessage");
qSender.send(messageSent);TestUtil.logMsg("Receive the TextMessage");
messageReceived = (TextMessage) qReceiver.receive(timeout);
qReceiver.close();
TestUtil.logMsg("Close the connection with no ack of message received");
newConn.close();TestUtil.logMsg("Use default connection to retrieve the unacknowledged message");
qSession = tool.getDefaultQueueConnection().createQueueSession(false,
Session.CLIENT_ACKNOWLEDGE);
qReceiver = qSession.createReceiver(tool.getDefaultQueue());
tool.getDefaultQueueConnection().start();messageReceived = (TextMessage) qReceiver.receive(timeout);
if (messageReceived == null)
else if (messageReceived.getText().equals(messageSent.getText()))
{ TestUtil.logMsg("Pass: received correct msg"); }else
{ TestUtil.logErr("Fail: didnt get correct msg"); pass = false; }try
{ messageReceived.acknowledge(); }catch (Exception e)
{ pass = false; TestUtil.logErr("Exception thrown on ack!", e); }if (!pass)
{ throw new Fault("Error: failures occurred during tests"); }} catch (Exception e)
{ TestUtil.printStackTrace(e); throw new Fault("closedQueueConnectionNoForcedAckTest"); }}If needed, I can provide also source of classes called in this method.Similar problem can be also seen in different test scenarious using acknowledging.