-
1. Re: Question on DeadLetterQueue
raghav.vis Mar 13, 2012 5:20 AM (in response to joe_boy12)Hello Joe,
The following is the API that would be needed to access the data in the queue
- select the column where the message is store in serialized form.
- Use the following
TO Deserialize (Fetching serialized data from queue):
import org.jboss.internal.soa.esb.util.Encoding;
import org.jboss.soa.esb.util.Util;
import java.io.Serializable;
Message msg = Util.deserialize((Serializable) Encoding.decodeToObject(result.getString("MSG")));
This would return object of type JBOSS Message.
Hope this helps. Let me know if you still need more details.
Regards,
Raghav.V
-
2. Re: Question on DeadLetterQueue
joe_boy12 Mar 14, 2012 8:52 PM (in response to raghav.vis)Thanks Raghav,
I am guessing the result.getString is from "message" table - while my messages are in JBM_MSG table. I tried converting Blob to string and tried decoding it - but blew-up NullPointerEx.
-
3. Re: Question on DeadLetterQueue
raghav.vis Mar 18, 2012 9:12 AM (in response to joe_boy12)Hello Joe,
The way the Message object gets stored in both the tables is quite similar, hence the method of retrieval would also be similar. I am not sure as to why you would be getting a null pointer exception. I had an entire redelivery model designed based on the retrieval and storage of data. It works like charm. Could you describe the way you are trying to retrieve it. meanwhile I will also try the same and will confirm you as early as possible.
-
4. Re: Question on DeadLetterQueue
joe_boy12 Mar 18, 2012 3:52 PM (in response to raghav.vis)this is how I tried -
I have a prepared statement for getting the payload out from DLQ
"select PAYLOAD from JBM_MSG msg where MESSAGE_ID in (Select message_ID from JBM_MSG_REF where channel_id = (select channel_id from JBM_POSTOFFICE where queue_name=?))";
Gives me a resultset back - the payload is BLOB...like below
Blob blob = rs.getBlob(1);
byte[] bytes = null;try
{
bytes = blob.getBytes(0L, (int)blob.length());
}
catch(Exception e)
{
bytes = rs.getBytes(1);
}String s = new String( bytes, "UTF-8" );
Message msg = Util.deserialize((Serializable) Encoding.decodeToObject(s));
blows up nullpointerex here in Encoding class
public static Serializable decodeToObject (String param) throws IOException, ClassNotFoundException
{
if (param == null)
throw new IllegalArgumentException();ContextObjectInputStream ois = null;
try
{
ByteArrayInputStream bs = new ByteArrayInputStream(Base64.decodeBase64(param.getBytes()));
ois = new ContextObjectInputStream(bs);return (Serializable) ois.readObject();
}
finally
{
ois.close(); // NullPointerException
}
}must be something wrong with Encoding I pass.
-
5. Re: Question on DeadLetterQueue
pasanperera Apr 2, 2012 7:06 AM (in response to joe_boy12)Refer the JDBCPersistenceManager class ('getMessages' method) in "jboss-messaging.jar" (download the source related to your jboss version). This shows how to convert the payload to the added message type. I have done it for MapMessages.
-
6. Re: Question on DeadLetterQueue
joe_boy12 Apr 2, 2012 9:02 PM (in response to pasanperera)perfect - I think its working now - I could deserialize few messages - I will run few more tests and see if its consistent. thnks a lot. the "message" table and jbm_msg table payload structures are different and Base64 decoding doesnt work similar way. I will add more details later.
-
7. Re: Question on DeadLetterQueue
smamdy Oct 31, 2012 7:04 PM (in response to joe_boy12)Hello
I'am getting the same problem and don't success in solving it.
Can share the solution you find ?
Thaks a lot,
Stséphane
-
8. Re: Question on DeadLetterQueue
joe_boy12 Nov 2, 2012 3:08 PM (in response to smamdy)Can you please elaborate the problem? I had a wrong jar in my classpath which was blowing NullPointerEx while deserializing the Message.