On 8/29/19 5:04 AM, A K wrote:
Hi Timothy And Team,
I posted below details through web ui
http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html but
latest comment and new topic is not reflecting on UI. I think, there
is some issue on UI.
#######
We are having one issue, so need your to help to fix this issue.
As per your suggestion on issue -
http://qpid.2158936.n2.nabble.com/Better-way-to-handle-MessageNotWriteableException-Message-is-currently-read-only-td7684002.html,
i am creating JMSMessage again whenever producer failed to send message.
For achieving this scenario, i need to extract(read) message content
from original JMS message. While extracting message content for
JmsBytesMessage/JmsStreamMessage, i am getting error
"javax.jms.MessageNotReadableException: Message body is write-only".
The information provided isn't enough to come to any conclusion on what
may be going on with the state of the message. I'd suggest gathering
some logging and AMQP frame traces when you reproduce this to aid in
seeing what the client is doing and what the conditions are that cause
the message to not be in a readable state. See the logging docs:
http://qpid.apache.org/releases/qpid-jms-0.45.0/docs/index.html#logging
You could also try and create a simple reproducer using the existing
client unit tests as a model. There was a test case added for
QPIDJMS-457 that covered the scenario in that issue where the message
was not restored to readable.
https://github.com/apache/qpid-jms/blob/master/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java#L3124
I also did similar testing for JmsTextMessage, JmsMapMessage,
JmsObjectMessage but there is no issue in these type of messages. We
are having issue only for JmsStreamMessage and JmsBytesMessage.
I did testing with "qpid-jms-client-0.40.0", "qpid-jms-client-0.43.0"
and "qpid-jms-client-0.45.0". Having same issue in all three of jars.
Please find attached error stack trace “JmsBytesMessage_Error.txt” and
“JmsStreamMessage_Error.txt”.
How To reproduce this issue ? – I did testing with ServiceBus.
1. First send message to Queue
2. Disable Queue/topic
3. Enable Queue/topic
4. Send message again which will throw error
“javax.jms.MessageNotReadableException: Message body is write-only”
Please find below code snippet for JmsBytesMessage
try {
sendMessage(message);
} catch (IllegalStateException illegalStateException) {
// Reset Producer due to Idle TimeOut after 10m
resetProducer();
Message recreatedMessage = reCreateMessage(message);
sendMessage(recreatedMessage);
}
Public Message reCreateMessage(Message message){
byte[] content = getMessageContent(message);
BytesMessage bMsg = session.createBytesMessage();
bMsg.writeBytes(content);
return bMsg;
}
Public byte[] getMessageContent(Message message){
BytesMessage message = (JmsBytesMessage)message;
byte[] bytes = new byte[(int) message.getBodyLength()];
message.readBytes(bytes);
return bytes;
}
Please let me know if you need any details.
Regards,
Abhishek Kumar
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Tim Bish