activebud schrieb:
Hi All,
I am using activemq 5 , mysql 5.0.37 and
mysql-connector-java-3.1.12-bin.jar
my activemq.xml as follows
<!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
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.org/config/1.0
http://activemq.apache.org/schema/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration
file -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"
dataDirectory="${activemq.base}/data">
<!-- Destination specific policies using destination names or wildcards
-->
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic="FOO.>" producerFlowControl="false"
memoryLimit="1mb">
<dispatchPolicy>
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<subscriptionRecoveryPolicy>
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
<transportConnector name="ssl" uri="ssl://localhost:61617"/>
<transportConnector name="stomp" uri="stomp://localhost:61613"/>
<transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
</transportConnectors>
<!-- The store and forward broker networks ActiveMQ will listen to -->
<networkConnectors>
<!-- by default just auto discover the other brokers -->
<networkConnector name="default-nc" uri="multicast://default"/>
<!--
<networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
-->
</networkConnectors>
<!-- Or if you want to use pure JDBC without a journal -->
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#mysql-ds"/>
</persistenceAdapter>
<!-- Use the following to set the broker memory limit
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="10 mb"
percentUsageMinDelta="20"/>
</memoryUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
<storeUsage>
<storeUsage limit="1 gb" name="foo"/>
</storeUsage>
</systemUsage>
</systemUsage>
-->
<!-- Use the following to configure how ActiveMQ is exposed in JMX
<managementContext>
<managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
</managementContext>
-->
</broker>
<!--
** Lets deploy some Enterprise Integration Patterns inside the ActiveMQ
Message Broker
** For more details see
**
** http://activemq.apache.org/enterprise-integration-patterns.html
-->
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<!-- You can use a <package> element for each root package to search for
Java routes -->
<package>org.foo.bar</package>
<!-- You can use Spring XML syntax to define the routes here using the
<route> element -->
<route>
<from uri="activemq:example.A"/>
<to uri="activemq:example.B"/>
</route>
</camelContext>
<!-- lets create a command agent to respond to message based admin
commands on the ActiveMQ.Agent topic -->
<commandAgent xmlns="http://activemq.org/config/1.0"/>
<!-- An embedded servlet engine for serving up the Admin console -->
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
<connectors>
<nioConnector port="8161" />
</connectors>
<handlers>
<webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
<webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
</handlers>
</jetty>
<!-- MySql DataSource Sample Setup -->
<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="activemq"/>
<property name="password" value="activemq"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
</beans>
and
activemq -help display as follows
URI:
XBean based broker configuration:
Example: Main xbean:file:activemq.xml
Loads the xbean configuration file from the current working
director
y
Example: Main xbean:activemq.xml
Loads the xbean configuration file from the classpath
URI Parameter based broker configuration:
Example: Main broker:(tcp://localhost:61616,
tcp://localhost:5000)?useJm
x=true
Configures the broker with 2 transport connectors and jmx
enabled
Example: Main broker:(tcp://localhost:61616,
network:tcp://localhost:500
0)?persistent=false
Configures the broker with 1 transport connector, and 1 network
connector and persistence disabled
when i start the activemq with above configurations it has created the data
base tables . but it didn't insert any records to tables.any thing wrong
with the configurations.I can see meeages are places in the queue when i run
the producer and it consumes the messages when i run the consumer.(monitored
with the activemq admin).
I tried with the examples provided with the activemq 5.
Thanks,
activebud
Did u use persistent Messages?