-
1. Re: View payload and header data in the table
ataylor Oct 20, 2008 4:43 AM (in response to mclu)Or does those blobs contain serialized/crypted objects?
yes the message is serialized. -
2. Re: View payload and header data in the table
mclu Oct 20, 2008 5:20 AM (in response to mclu)Thx!
Does anyone know a configurable web application (war) which can be used to monitor jms queues. I used hermesJMS a bit but I am searching for a web based solution.
Thx for hints. -
3. Re: View payload and header data in the table
noelo Oct 20, 2008 7:46 AM (in response to mclu)You could look at the Jboss ON (Operations Network) product. See http://www.theserverside.com/news/thread.tss?thread_id=51222
-
4. Re: View payload and header data in the table
pasanperera Apr 3, 2012 7:40 AM (in response to mclu)If you want to get the javax.jms.Message (or any other message types that you have added to the queue) the following will help.
Note that most of the source is copied from JDBCPersistenceManager class in package "jboss-messaging-1.4.2.GA-SP1
Write a query to retrieve all columns from JBM_MSG
if (rs.next())
{
long messageId = rs.getLong("MESSAGE_ID");
boolean reliable = rs.getString("RELIABLE").equals("Y");
long expiration = rs.getLong("EXPIRATION");
long timestamp = rs.getLong("TIMESTAMP");
byte priority = rs.getByte("PRIORITY");
byte[] bytes = getBytes(rs, "HEADERS");
HashMap headers = bytesToMap(bytes);
byte[] payload = getBytes(rs, "PAYLOAD");
byte type = rs.getByte("TYPE");
MapMessage m = (MapMessage)MessageFactory.createMessage(messageId, reliable, expiration, timestamp, priority, headers, payload,
type);
}
protected byte[] getBytes(ResultSet rs, String column) throws Exception
{
// Get the bytes using a binary stream - likely to be better for large
// byte[]
InputStream is = null;
ByteArrayOutputStream os = null;
final int BUFFER_SIZE = 4096;
try
{
InputStream i = rs.getBinaryStream(column);
if (i == null)
{
return null;
}
is = new BufferedInputStream(rs.getBinaryStream(column), BUFFER_SIZE);
os = new ByteArrayOutputStream(BUFFER_SIZE);
int b;
while ((b = is.read()) != -1)
{
os.write(b);
}
return os.toByteArray();
}
finally
{
if (is != null)
{
is.close();
}
if (os != null)
{
os.close();
}
}
}
-
5. Re: View payload and header data in the table
lbilger Apr 4, 2012 9:36 AM (in response to pasanperera)Pasan,
would you say this solution is suitable for production code or just for debugging? Would it work for retrieving all messages in a clustered queue? It might be just the thing I'm looking for - see my post at https://community.jboss.org/thread/197924. But I feel like this is meddling with JBoss internals, so maybe it shouldn't be used in production?
-
6. Re: View payload and header data in the table
pasanperera Jun 8, 2012 1:55 AM (in response to lbilger)Hi Lars,
Sorry for the late reply. I haven't used it in production. Well are you refering to licensing issues is it? Well personally I never felt so as I have been only using their methods. Please correct me if I am wrong as I may use it if I need in the future. Technically I dont see any issues as I am only trying to view the messages.
-
7. Re: View payload and header data in the table
lbilger Jun 8, 2012 2:58 AM (in response to pasanperera)Hi Pasan,
Thanks for your reply. I was rather thinking about maintainability and stability - what if we move to a newer version of JBoss and they change the way the messages are internally stored? As this seems to be no public API, I guess they could change it any time. Then we would have to change our code as well.
We ended up creating our own database table to log whenever a message is produced or consumed, so we keep track of the existing messages "manually".
-
8. Re: View payload and header data in the table
pasanperera Jun 8, 2012 3:21 AM (in response to lbilger)Yes Lars there is a problem as such and its good to know how you solved the problem.
Chances of it affecting our application is very small as we use only a specific version & we wouldnt change it, so was not concerned about it.
Thanks for pointing it out, If I use it, I should actually document it somewhere.
-
9. Re: View payload and header data in the table
kebishishabi Jul 3, 2012 11:55 PM (in response to pasanperera)very good !
it's works ! thank you ,by the way,what is the method about "bytesToMap()" is it likes 'getBytes()' method?