[JBoss Messaging] - ((BytesMessage)message).readBytes(...) on a redelivered Byte
by plesur
JBoss 4.2.2.GA
JBoss Messaging 1.4.0.SP3
JBoss Remoting 2.2.2.SP7
Hi,
my 'payload'-bytearray (see below) which has been declared and initialized via:
byte[] payload = new byte[(int)bytesmessage.getBodyLength()];
has the right size ((int)bytesmessage.getBodyLength() still returns the correct size of a redelivered BytesMessage's payload).
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.
It plays not matter if I'm testing with standalone remote MessageListener-ClientApplications or under deployed MDBs - same behavior.
| public void onMessage( Message message )
| {
| try
| {
| if (message instanceof BytesMessage)
| {
| // Create bytemessage object to hold the content of the bytemessage
| BytesMessage bytesmessage = (BytesMessage)message;
|
| // Create bytearray in size of the bytemessage
| byte[] payload = new byte[(int)bytesmessage.getBodyLength()];
|
| // Read the bytemessage
| bytesmessage.readBytes(payload);
|
| .
| .
| .
|
It sounds a bit like:
http://jira.jboss.org/jira/browse/JBMESSAGING-1079
but this is old and should be fixed since 1.4.0.SP1
Can someone replicate this - or am I doing something wrong?
Thanks in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145114#4145114
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145114
18 years, 3 months
[JBoss Messaging] - Re: MQ migration help
by tnine
I have one final question regarding Dead Letter Queues. I have configured both my statement input and statement output queues to use a specific DLQ. Sometimes our MDBs are given invalid data, usually due to file charset issues, and I'd like to be notified processing fails so we can fix the input. When I fed our MDB invalid input I saw the following behavior.
|
| * Send 4 messages to the queue StatementInput. 2 are valid 2 are not.
|
| * The MDB processes 2 messages, and throws exceptions on processing the 2 invalid messages. As a result, these 2 messages should go in to the StatementDLQ
|
| * At this point, I go to the JMX console and view the information on both the DLQ and StatementDLQ. StatementDLQ has a message count of 0, but DLQ has a message count of 2. This seems to be the opposite of what I'd expect
|
| * Start the process that syncrhonously reads from the StatementDLQ queue. The first time it tries to consume messages with the receiveNoWait() method null is returned. This makes sense given that the JMX console says there are no messages in StatementDLQ
|
| * When the Queue monitor wakes up for its second pass 30 seconds later, it receives 2 messages from the queue StatementDLQ. I don't understand this, since the JMX console says there are no messages in the queue.
|
|
Perhaps I'm missing the point, but after step 2, should StatementDLQ have a MessageCount of 2 and DLQ have a MessageCount of 0? Below is my configuration from my destinations-service.xml file.
| <!-- Input Queue for statements -->
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementInput"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="DLQ">
| jboss.messaging.destination:service=Queue,name=StatementDLQ
| </attribute>
| <attribute name="Clustered">true</attribute>
| <attribute name="MaxDeliveryAttempts">2</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
|
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementOutput"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="DLQ">
| jboss.messaging.destination:service=Queue,name=StatementDLQ
| </attribute>
| <attribute name="Clustered">true</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
| </mbean>
|
|
| <!-- DLQ for statements -->
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementDLQ"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="Clustered">true</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
| </mbean>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145110#4145110
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145110
18 years, 3 months