I have a requirement where failed messages (after certain retries) should go to a designated DLQ where Prod Support people can jump in and inspect the message. I am using jms-jca provider to have retry logic and activation config to move failed messages to DLQ. The problem is the messages in DLQ are jBoss serialized message and cannot be read easily. Prod Support team wants something handy where they can inspect the message, edit it and resend - I can write a listener on DLQ to convert it to plain text message and show it in JSP or UI but I will have to do it for each n every DLQ - my system has at least 50-60 DLQs. (for various interfaces) - I want some thing which can read from a DLQ - Deserialize it and edit it - I can use ServiceInvoker to serialize it and put in back in my pipeline flow. Has anybody dealt it with before? Any help would be greatly appreciated.
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):
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.
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.
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;
bytes = blob.getBytes(0L, (int)blob.length());
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;
ByteArrayInputStream bs = new ByteArrayInputStream(Base64.decodeBase64(param.getBytes()));
ois = new ContextObjectInputStream(bs);
return (Serializable) ois.readObject();
ois.close(); // NullPointerException
must be something wrong with Encoding I pass.