On 5/13/19 8:32 AM, akabhishek1 wrote:
Hi Team,
ServiceBus forcefully disconnect producer for 10m idle timeout. We are
handling this situation with below code snippet ("//***Code At Time Of
Error***"), but we are getting strange error
"javax.jms.MessageNotWriteableException: Message is currently read-only".
This is a very rare error, and we haven't received this error from one year.
There is a bug in the client that is causing this to happen when sending
to a connection that has already dropped before you get round to
sending, it is fixed now in QPIDJMS-457 and will be in the next release.
https://issues.apache.org/jira/browse/QPIDJMS-457
We are not not able to reproduce this issue as well. However, we came to
conclusion that copy of message to origionalJmsMessage "final Message
origionalJmsMessage = message", that could be issue. Because i am copying
"message" via reference instead of value.
So i changed the logic to copy value by "Message origionalJmsMessage =
(org.apache.qpid.jms.message.JmsMessage)message).copy();"
I am not sure, this approach is bullet proof or not.
Could you please suggest your opinion to preserve JMS message in a better
way and send again for handling idle timeout of the producer.
//Artifact Version
qpid-jms-client - 0.40.0
Broker - Azure ServiceBus
Java - JBK8
OS - Linux
//***Code At Time Of Error***
final Message origionalJmsMessage = message; // message = javax.jms.Message
try {
sendMessage(message);
} catch (IllegalStateException illegalStateException) {
// Reset Producer due to Idle TimeOut after 10m
resetProducer();
sendMessage(origionalJmsMessage);
}
//**Code After Correction***
Message origionalJmsMessage;
try {
sendMessage(message); // message = javax.jms.Message
} catch (IllegalStateException illegalStateException) {
// Reset Producer due to Idle TimeOut after 10m
resetProducer();
origionalJmsMessage =
((org.apache.qpid.jms.message.JmsMessage)message).copy();
sendMessage(origionalJmsMessage);
}
//***Exception Stack Trace***
Caused by: javax.jms.MessageNotWriteableException: Message is currently
read-only
org.apache.qpid.jms.message.JmsMessage.checkReadOnly(JmsMessage.java:509)
org.apache.qpid.jms.message.JmsMessage.setJMSDeliveryMode(JmsMessage.java:242)
org.apache.qpid.jms.JmsSession.send(JmsSession.java:817)
org.apache.qpid.jms.JmsSession.send(JmsSession.java:811)
org.apache.qpid.jms.JmsMessageProducer.sendMessage(JmsMessageProducer.java:252)
org.apache.qpid.jms.JmsMessageProducer.send(JmsMessageProducer.java:182)
Regards,
Abhishek Kumar
--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Tim Bish
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]