How to decode content of SOA-P's MESSAGE table ?
Environment
- Red Hat JBoss Enterprise SOA Platform (SOA-P)
- 5.x
Issue
- Is there a way we can decode the content of the
MESSAGEtable to see what the message is?
Resolution
-
In order to decode the content of the
MESSAGEcolumn to see what the message is , use the sample code sample provided in the DBMessageStoreImpl class. -
Use the mechanism of executing a
selectquery onMESSAGEtable to obtain the data frommessagecolumn and then use the internal ESB API's to deserialize the ESB Message object.
message = Util.deserialize((Serializable) Encoding.decodeToObject(rs.getString("message")));
After the Message type of object is obtained use it to extract details from the Message type of object as per your requirement. This is shown in the following method from DBMessageStoreImpl class for reference :
...
private Message select(URI uid, Connection connection)
throws SQLException, MessageStoreException
{
Message message=null;
String selectSql = "select * from "+tableName+" where uuid=?";
PreparedStatement selectStmt = null;
ResultSet rs = null;
try
{
selectStmt = connection.prepareStatement(selectSql);
selectStmt.setObject(1, uid.toString());
rs = selectStmt.executeQuery();
if (rs.next()) {
try {
message = Util.deserialize((Serializable) Encoding.decodeToObject(rs.getString("message")));
} catch (Exception e) {
throw new MessageStoreException(e);
}
}
}
finally
{
try
{
if (rs != null)
rs.close();
}
catch (final Exception ex)
{
logger.warn("Could not close ResultSet.", ex);
}
try
{
if (selectStmt != null)
selectStmt.close();
}
catch (final Exception ex)
{
logger.warn("Could not close Statement.", ex);
}
}
return message;
}
...
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
