-
1. Re: ((BytesMessage)message).readBytes(...) on a redelivered
jmesnil Apr 18, 2008 8:37 AM (in response to plesur)"plesur" wrote:
But then calling bytesmessage.readBytes(payload) method on a redelivered BytesMessage results in a strange behavior (maybe only strange for me:) - the 'payload'-bytearray is still initialized although as I can see when I debug my project the JBossBytesMessage.payloadAsByteArray[] property (private) isn't empty and holds the right content.
I'm not sure to follow you: you say that your 'payload' byte array is initialized with the content of the BytesMessage, right?
If that's the case, it is the expected behavior.
hope it helps,
jeff -
2. Re: ((BytesMessage)message).readBytes(...) on a redelivered
plesur Apr 18, 2008 8:49 AM (in response to plesur)"jmesnil" wrote:
I'm not sure to follow you: you say that your 'payload' byte array is initialized with the content of the BytesMessage, right?
If that's the case, it is the expected behavior.
hope it helps,
jeff
Hi Jeff,
with initialized i mean a new created empty bytearray in the size of the Bytemessage's payload:
byte[] payload = new byte[(int)bytesmessage.getBodyLength()];
with:
bytesmessage.readBytes(payload);
it should be filled - this is what didn't work for me on a >redelivered message<. -
3. Re: ((BytesMessage)message).readBytes(...) on a redelivered
jmesnil Apr 18, 2008 11:59 AM (in response to plesur)"plesur" wrote:
with initialized i mean a new created empty bytearray in the size of the Bytemessage's payload:
byte[] payload = new byte[(int)bytesmessage.getBodyLength()];
with:
bytesmessage.readBytes(payload);
it should be filled - this is what didn't work for me on a >redelivered message<.
Ok, we're on the same page.
This is indeed weird. We have a JUnit test BytesMessageTest.testRedelivery() which checks this use case and this test pass for JBM 1.4.0.SP3.
Our test does not use a MessageListener but I don't think it'd affect the message behaviour.
Can you write a unit test which reproduces your problem in your environment? -
4. Re: ((BytesMessage)message).readBytes(...) on a redelivered
plesur Apr 21, 2008 2:28 PM (in response to plesur)Hi Jeff,
sorry wasn't available for the last two days.
I know now how I can prevent an empty byte-array on a redelivered bytemessage (redelivered by session.recover() on a non-transacted client_acknowledge-session)
which I get by invoking the previous mentioned standardoperations.
The problem 'at our site' seems to be based on the configuration attributes:
. DefaultRedeliveryDelay (messaging-service.xml) &
. RedeliveryDelay (destinations-service.xml) (overwrites ServerPeer default)
My testresults for readBytes(...) on a redelivered bytesmessage with payloadAsByteArray=[72, 73, 95, 74, 69, 70, 70, 10]:
using the standard non clustered destination: testQueue.
with 0 or 1 msec as DefaultRedeliveryDelay & RedeliveryDelay or no entry (RedeliveryDelay only of course)
are:
ServerPeer (DefaultRedeliveryDelay) --- Destination (RedeliveryDelay) --- Result (Content of byte[] after .readBytes(...))
-------------------------------------
0 --- 0 --- [0, 0, 0, 0, 0, 0, 0, 0]
1 --- 0 --- [0, 0, 0, 0, 0, 0, 0, 0]
0 --- 1 --- [72, 73, 95, 74, 69, 70, 70, 10]
1 --- 1 --- [72, 73, 95, 74, 69, 70, 70, 10]
0 --- / --- [0, 0, 0, 0, 0, 0, 0, 0]
1 --- / --- [72, 73, 95, 74, 69, 70, 70, 10]
The weird thing is that case #5 can be found as part of the default configuration.
Well it's hard to believe that 'our' problem is based only on these two attributes
(many others would have the same problem then) but I can live with it knowning
that in the end the final saying delayattribute must have an value greater or equal one msec.
lesse