-
1. Re: Consumed messages redelivered ?
timfox Jul 3, 2006 2:34 PM (in response to dv_lakshmi)When persistent messages are acked they will be removed from the jms_message_reference table.
When all references to the message (the same message can be in many queues or subscriptions) are acked, it will be removed from the jms_message table.
MessageCount represents the total number of messages in the queue at that time.
For auto acknowledgement the message is acked when the call to receive has returned or when the onMessage method has finished executing
(see http://java.sun.com/j2ee/1.4/docs/api/index.html)
If this is not what you are seeing please send me your code and I will take a look. -
2. Re: Consumed messages redelivered ?
dv_lakshmi Jul 4, 2006 3:04 AM (in response to dv_lakshmi)Firstly , when I debug into the code I see that no exceptions arise and onMessage invocation ends successfully. So I believe that my application is functioning correctly and the messages are processed successfully. Therefore an acknowledgement should have been sent thereby which the contents of the jms tables should have been deleted accordingly. But this has not happened.
Second, If the messages have not received an acknowledgement, then when are the messages retried ? As long as the server is running, I dont see these messages that exist in the table to be processed again by the listeners. However, when I restart my server, these messages are being picked up by the listener. I am puzzled as my application works absolutely fine till the server is restarted !!
Sending the code might be a bit clumsy as it spans across many files. If there is a way I can send the snapshot of JMS_MESSAGE and JMS_MESSAGE_REFERENCE tables which might aid debugging please let me know so. -
3. Re: Consumed messages redelivered ?
dv_lakshmi Jul 4, 2006 3:21 AM (in response to dv_lakshmi)Also please note that I have separated the "create table" sql statements from oracle-persistence.xml and have put them in a separate configuration file which I run before I start jboss. I have made the property "CreateTablesOnStartup" as false too and I have left the remaining sqls (INSERT, DELETE, UPDATE) statements as it is in the oracle-persistence.xml file. Now is this making any difference ?
Now I believe that If I leave the create statements in the oracle persistence xml and leave the "CreateTablesOnStartup" property to true, then the tables are created on server startup. In this case, are the messages which were not delivered successfully lost on server restart? -
4. Re: Consumed messages redelivered ?
timfox Jul 4, 2006 4:30 AM (in response to dv_lakshmi)Please replicate in a simple test case, and send to me and I will investigate.
Thanks. -
5. Re: Consumed messages redelivered ?
timfox Jul 4, 2006 4:33 AM (in response to dv_lakshmi)You don't have to send all your code. Just replicate with a simple message listener, this is the normal proceedure...
-
6. Re: Consumed messages redelivered ?
mskonda Jul 5, 2006 3:41 AM (in response to dv_lakshmi)"dv_lakshmi" wrote:
Also please note that I have separated the "create table" sql statements from oracle-persistence.xml and have put them in a separate configuration file which I run before I start jboss. I have made the property "CreateTablesOnStartup" as false too and I have left the remaining sqls (INSERT, DELETE, UPDATE) statements as it is in the oracle-persistence.xml file. Now is this making any difference ?
It shouldn't be. You can always create the tables according to your applicaiton installation or configuration policies(that is, you don't have to wait for the server to create the tables on startup at all). If the flag is set to true, the tables are created if and only if they are non-existent. If they are already existent (wheather you have created via a script or first time server startup), an debug exception is logged to say that the said table is already existing, but this is just a log statment that can be ignored!
Now I believe that If I leave the create statements in the oracle persistence xml and leave the "CreateTablesOnStartup" property to true, then the tables are created on server startup. In this case, are the messages which were not delivered successfully lost on server restart?
See above explanation about creating tables on startup.
Thanks
Madhu -
7. Re: Consumed messages redelivered ?
mskonda Jul 5, 2006 4:13 AM (in response to dv_lakshmi)"dv_lakshmi" wrote:
Second, If the messages have not received an acknowledgement, then when are the messages retried ? As long as the server is running, I dont see these messages that exist in the table to be processed again by the listeners. However, when I restart my server, these messages are being picked up by the listener. I am puzzled as my application works absolutely fine till the server is restarted !!
Could you confirm that your transactions are committed? (You can check the state of the transaction in JMS_TRANSACTION table). If there exists a row, this indicates you have a uncomitted (prepared) tx.
Thanks
Madhu -
8. Re: Consumed messages redelivered ?
timfox Jul 5, 2006 4:16 AM (in response to dv_lakshmi)My guess is that you are using a transacted session and not committing, or using client acknowledge and not explicitly acknowledging.
Although without seeing a test case I can replicate I am just guessing. -
9. Re: Consumed messages redelivered ?
dv_lakshmi Jul 5, 2006 6:00 AM (in response to dv_lakshmi)
Could you confirm that your transactions are committed? (You can check the state of the transaction in JMS_TRANSACTION table). If there exists a row, this indicates you have a uncomitted (prepared) tx.
JMS_TRANSACTION table is empty.My guess is that you are using a transacted session and not committing, or using client acknowledge and not explicitly acknowledging.
createQueueSession(false,Session.AUTO_ACKNOWLEDGE)
Nope, The session is not transacted and is auto acknowledged .
I am working on isolating the problem using a smaller test case. Part of the complexity is because the application uses spring transaction management + jms listener plugin to register my queue listeners. -
10. Re: Consumed messages redelivered ?
timfox Jul 5, 2006 6:38 AM (in response to dv_lakshmi)BTW, are you using RC3? If not, I recommend upgrading to this version.
-
11. Re: Consumed messages redelivered ?
dv_lakshmi Jul 5, 2006 6:53 AM (in response to dv_lakshmi)I have tested on RC3 as well and the issue still persists.
-
12. Re: Consumed messages redelivered ?
dv_lakshmi Jul 5, 2006 8:04 AM (in response to dv_lakshmi)Tim, I have sent the source code by mail to your jboss account. Sorry, I forgot to mention how to run the application. Invoke "TunnelServlet" on a browser and it should send a message.
-
13. Re: Consumed messages redelivered ?
timfox Jul 5, 2006 8:05 AM (in response to dv_lakshmi)Lakshmi-
The test case you send me needs to have no spring dependencies. We can't spend our time debugging people's Spring applications :)
I.e. straight JMS code -
14. Re: Consumed messages redelivered ?
dv_lakshmi Jul 5, 2006 8:13 AM (in response to dv_lakshmi)Well, part of the problem can be replicated even without the spring code. i.e., the message sending problem as mentioned in the email.