activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuvaraj Vanarase <>
Subject RE: ActiveMq persistence in xml
Date Wed, 28 Dec 2011 08:52:16 GMT
Well, now there are several cuts here.

(1). I believe byte array you get is the serialized object/bytes. Just converting these serialized
bytes into String won't help. Serialized object becomes readable/meaningful only after de-serialization.
Converting to string will have extra bytes as per serialization protocol.
(2). The Frame size for ActiveMQ is 100 MB, you can't exceed it unless you configure suitable
one. Not sure though, however it shouldn't be encouraged. Anyways, you can refer:
(3). My suggestion is (if possible)-
 let your Object implements Externalizable instead of Serializable. Thus you get control on
what exactly you want to write; this should minimize the data size getting transferred over
NW. Now instead of writing whole serialized object (setBinaryData()), de-serialized it and
convert only required fields into bytes. Reverse logic in (getBinaryData())   


Yuvaraj Vanarase,
Lead Technology - Software
Phone: +91.20.40262000 Ext 2305|Mobile: +91.9850818870 |
- Top 15 Best IT Employers for 5 consecutive years (link).
- Celebrating 10 Years!

-----Original Message-----
From: Sheetal Kulkarni [] 
Sent: Tuesday, December 27, 2011 7:26 PM
Subject: RE: ActiveMq persistence in xml


Thanks a lot, I am trying for the 3rd point. Seeing messages in database as 'String' and not
binary data.
However now I am getting exception as below:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in cl
ass path resource [activemq.xml]: Invocation of init method failed; nested excep
tion is Frame size of 771 MB larger than max allowed 100 MB


And my piece of code is as below:
class MyJdbcAdapter extends DefaultJDBCAdapter{
     protected byte [] getBinaryData(ResultSet rs, int index)throws SQLException{
             System.out.println("#########get binary data called##########");
             String data = rs.getString(index);
             return data.getBytes();

       }catch(Exception e){
             throw new SQLException("Error reading binary data");

     protected void setBinaryData(PreparedStatement s, int index , byte[] data) throws SQLException{
       System.out.println("#########set binary data called##########");
       s.setString(index, new String(data));
       System.out.println(new String(data));
       System.out.println("#########after setting the string#######");

It fails for 'getBinaryData' call.

From: Yuvaraj Vanarase [via ActiveMQ] []
Sent: Tuesday, December 27, 2011 5:41 PM
To: Kulkarni, Sheetal
Subject: RE: ActiveMq persistence in xml

Not clearly understood the requirement. However--

1. if you would like to see message contents (readable I would say), let say using web console
of activemq, then just clicking on message does that provided toString() method implemented
accordingly for that class
2. if you would like to display the content to user/client in XML format..then offcourse object
can be represented as XML using DOM or even Loggers do that e.g. log4j/logback
3. If you want to show someone, the object stored in DB(e.g. object stored as XMLType in Oracle),
then you might have to override default behavior of JDBCAdapter to control the read/write
for specific DB

hope this helps!


-----Original Message-----
From: Sheetal Kulkarni [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4236969&i=0>]
Sent: Tuesday, December 27, 2011 5:04 PM
To: [hidden email]</user/SendEmail.jtp?type=node&node=4236969&i=1>
Subject: ActiveMq persistence in xml


Does anyone knows how i can store the activemq messages in form of xml?
Currently it stores messages as binary in database, i want to have a
application which reads messages from database and show some analysis of
those messages.

Please comment.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from ActiveMq persistence in xml, click here<>.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message