Hi,

Thanks for your help. I was able to store the messages in the form of xml and 
retrieve them back ☺.
Moving a step ahead, I was trying to use camel in activemq.
I want to have transactions enabled in camel routes.
Can you please guide me ?

My below configuration  of camel beans throws “NullPointerException”
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
                                <property name="maximumRedeliveries">
                                  <value>"-1"</value>
                                </property>
                                <property name="useExponentialBackOff">
                                <value>"false"</value>
                                </property>
                                <property name="initialRedeliveryDelay">
                                <value>"10"</value>
                                </property>
</bean>

  <bean id="jmsConnectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
                    <value>"vm://localhost:61616"</value>
   </property>
    <property name="redeliveryPolicy" ref="redeliveryPolicy" />
    </bean>

                           <bean id="jmsTransactionManager" 
class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
  </bean>



    <!-- configure the camel activemq component to use the current broker -->
    <bean id="activemq" 
class="org.apache.activemq.camel.component.ActiveMQComponent" >
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
       <property name="transacted" >
                        <value>"true"</value>
                                <property/>
                                <property name="transactionManager" 
ref="jmsTransactionManager"/>
    </bean>



From: Yuvaraj Vanarase [via ActiveMQ] 
[mailto:ml-node+s2283324n4239366...@n4.nabble.com]
Sent: Wednesday, December 28, 2011 2:23 PM
To: Kulkarni, Sheetal
Subject: RE: ActiveMq persistence in xml

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: http://activemq.apache.org/configuring-wire-formats.html
(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())

Regards,
Yuvaraj

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


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

Hi,

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 java.io.IOException: Frame size of 771 MB larger than max allowed 100 MB

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)

And my piece of code is as below:
class MyJdbcAdapter extends DefaultJDBCAdapter{
     protected byte [] getBinaryData(ResultSet rs, int index)throws 
SQLException{
       try{
             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.

Thanks,
Sheetal
From: Yuvaraj Vanarase [via ActiveMQ] [mailto:[hidden 
email]</user/SendEmail.jtp?type=node&node=4239366&i=2>]
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
http://activemq.apache.org/maven/5.3.1/activemq-core/apidocs/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.html

hope this helps!

Regards,
Yuvaraj


-----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

Hi,

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.
Sheetal

--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMq-persistence-in-xml-tp4236892p4236892.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

________________________________
If you reply to this email, your message will be added to the discussion below:

NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMq-persistence-in-xml-tp4236892p4237129.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

________________________________
If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/ActiveMq-persistence-in-xml-tp4236892p4239366.html
To unsubscribe from ActiveMq persistence in xml, click 
here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4236892&code=U2hlZXRhbC5LdWxrYXJuaUBzdW5nYXJkLmNvbXw0MjM2ODkyfDg0MDQzMzA0OA==>.
NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMq-persistence-in-xml-tp4236892p4302840.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to