When a stomp queue message sent with "expires" property set to non-zero, AMQ will not route it to the destination.
I have added a function to the unit test class org.apache.activemq.transport.stomp.StompTest, to expose that bug.
public void testStompExpireProperty() throws Exception
It connects to a stomp server (AMQ) and subscribes for a queue. Then it sends a SEND frame to this queue with "expires" set to non-zero value. On version 5.0, you will get this exception:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.net.SocketInputStream.read(SocketInputStream.java:182)
at org.apache.activemq.transport.stomp.StompConnection.receiveFrame(StompConnection.java:64)
at org.apache.activemq.transport.stomp.StompConnection.receiveFrame(StompConnection.java:56)
at org.apache.activemq.transport.stomp.StompTest.testStompExpireProperty(StompTest.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.apache.activemq.CombinationTestSupport.runBare(CombinationTestSupport.java:98)
at org.apache.activemq.CombinationTestSupport.runBare(CombinationTestSupport.java:104)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Attached is a diff file for the unit test.
test function like this worked all right:
public void testStompExpireProperty() throws Exception { String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL; stompConnection.sendFrame(frame); frame = stompConnection.receiveFrame(); assertTrue(frame.startsWith("CONNECTED")); frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; stompConnection.sendFrame(frame); long expires = 10; frame = "SEND\n" + "destination:/queue/" + getQueueName() +"\n"+"expires:"+System.currentTimeMillis()+expires+"\n\n" + "Hello World" + Stomp.NULL; stompConnection.sendFrame(frame); frame = stompConnection.receiveFrame(); assertTrue(frame.startsWith("MESSAGE")); }