You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by pp <pr...@gmail.com> on 2010/09/14 19:17:00 UTC

how to save topics and messages in mysql database

hi, 

         Do the topics are saved in the activemq database itself or we have
to handle it. if it automatically store on the activemq database then where
these tables are present. We are using the external database MySql. But it
is showing only three tables  activemq_acks, activemq_msgs, activemq_lock.
Where are the other tables present like table for topic. 
  
Any help is appreciable. 
  
Thanks 
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539322.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: *** GMX Spamverdacht *** Re: how to save topics and messages in mysql database

Posted by "Martin C." <ma...@gmx.at>.
Hi,

On Thu, Sep 16, 2010 at 9:38 AM, pp <pr...@gmail.com> wrote:

> For activemq must we have the broker(activemq) at every subscriber's server
> ?

No, you just need one server (broker) to which all clients connect to.

Best regards,
Martin

Re: how to save topics and messages in mysql database

Posted by pp <pr...@gmail.com>.
I have one more question.

For activemq must we have the broker(activemq) at every subscriber's server
? 
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2541661.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: how to save topics and messages in mysql database

Posted by pp <pr...@gmail.com>.
I have one more problem gary..


I am producing messages i have just overrite the onmessage method.
its just increasing the enqueued msg in activemq admin but it is not
displayng these messages in MySql database. What can be thje problem.
  

Plz help me regarding this.
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2540378.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: how to save topics and messages in mysql database

Posted by pp <pr...@gmail.com>.
thanks gary.
my configuration file is


<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:amqpersistenceadapter="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.base}/conf/credentials.properties</value>
        </property>      
    </bean>
<bean id="mysql-ds"
       class="org.apache.commons.dbcp.BasicDataSource"
       destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url"
            value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
    <property name="username" value="root"/>
    <property name="password" value="12345"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>

    <!-- 
        The <broker> element is used to configure the ActiveMQ broker. 
    -->
    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.base}/data"
destroyApplicationContextOnStop="true">
 
        <!--
			For better performances use VM cursor and small memory limit.
			For more information, see:
            
            http://activemq.apache.org/message-cursors.html
            
            Also, if your producer is "hanging", it's probably due to
producer flow control.
            For more information, see:
            http://activemq.apache.org/producer-flow-control.html
        -->
              
        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true"
memoryLimit="1mb">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="1mb">
                  <!-- Use VM cursor for better latency
                       For more information, see:
                       
                       http://activemq.apache.org/message-cursors.html
                       
                  <pendingQueuePolicy>
                    <vmQueueCursor/>
                  </pendingQueuePolicy>
                  -->
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy> 
 
        
        <!-- 
            The managementContext is used to configure how ActiveMQ is
exposed in 
            JMX. By default, ActiveMQ uses the MBean server that is started
by 
            the JVM. For more information, see: 
            
            http://activemq.apache.org/jmx.html 
        -->
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <!-- 
            Configure message persistence for the broker. The default
persistence
            mechanism is the KahaDB store (identified by the kahaDB tag). 
            For more information, see: 
            
            http://activemq.apache.org/persistence.html 
        -->

        <persistenceAdapter>
        <jdbcPersistenceAdapter
dataDirectory="${activemq.base}/activemq-data"
            dataSource="#mysql-ds"/>
    </persistenceAdapter>
        
        
          <!--
            The systemUsage controls the maximum amount of space the broker
will 
            use before slowing down producers. For more information, see:
            
            http://activemq.apache.org/producer-flow-control.html
             
        <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="20 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="1 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="100 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>
		-->
		  
        <!-- 
            The transport connectors expose ActiveMQ over a given protocol
to
            clients and other brokers. For more information, see: 
            
            http://activemq.apache.org/configuring-transports.html 
        -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>

    </broker>
 

    <!-- 
        Uncomment to enable Camel
        Take a look at activemq-camel.xml for more details
         
    <import resource="camel.xml"/>
    -->

    <!-- 
        Enable web consoles, REST and Ajax APIs and demos
        Take a look at activemq-jetty.xml for more details 
    -->
    <import resource="jetty.xml"/>
    
</beans>






-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2540370.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: how to save topics and messages in mysql database

Posted by Gary Tully <ga...@gmail.com>.
is useExternalMessageReferences set on the jdbc persistence adapter?
It defaults to false, to see the messages in the store it needs to be
false.
Maybe post your configuration.

On 15 September 2010 07:49, pp <pr...@gmail.com> wrote:
>
> thanks again. but one prob my activemq_msgs table is not showing the
> destination_id column.
> and it only contain the reference of the message.
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539995.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: how to save topics and messages in mysql database

Posted by pp <pr...@gmail.com>.
thanks again. but one prob my activemq_msgs table is not showing the
destination_id column.
and it only contain the reference of the message.
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539995.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: how to save topics and messages in mysql database

Posted by Stan Lewis <sl...@fusesource.com>.
Think Gary answered this for you in another thread, but in case you
missed it in the activemq_msgs table there's a column that has the
destination ID, this is for either topics or queues.

On Tue, Sep 14, 2010 at 1:49 PM, pp <pr...@gmail.com> wrote:
>
> thanks stan for ur help.. but i want to know where the topics are created in
> the database . where these are save. because the database only contain three
> tables. none of the table contai the available topics or created topics.
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539384.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: how to save topics and messages in mysql database

Posted by pp <pr...@gmail.com>.
thanks stan for ur help.. but i want to know where the topics are created in
the database . where these are save. because the database only contain three
tables. none of the table contai the available topics or created topics.
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539384.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: how to save topics and messages in mysql database

Posted by Stan Lewis <sl...@fusesource.com>.
All of ActiveMQ's messages are stored in that activemq_msgs table, at
least when you're sending persistent messages.  Create a durable
subscription on your topic and send some persistent messages to it,
you'll see new entries get added to activemq_msgs.  Note that once a
message is ack'd it's removed from the table, so if you want to save
messages you could set up a mirrored queue to keep those messages
around, have a look at http://activemq.apache.org/mirrored-queues.html

On Tue, Sep 14, 2010 at 1:17 PM, pp <pr...@gmail.com> wrote:
>
> hi,
>
>         Do the topics are saved in the activemq database itself or we have
> to handle it. if it automatically store on the activemq database then where
> these tables are present. We are using the external database MySql. But it
> is showing only three tables  activemq_acks, activemq_msgs, activemq_lock.
> Where are the other tables present like table for topic.
>
> Any help is appreciable.
>
> Thanks
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/how-to-save-topics-and-messages-in-mysql-database-tp2539322p2539322.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>