activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Holmes <iamstevehol...@gmail.com>
Subject Recieving the same message 10 times, Spring, and Camel
Date Wed, 21 Apr 2010 20:12:41 GMT

Hi All!
Keep in mind that I am completely new to ActiveMQ and message brokers in
general.  I've been setting up a configuration within spring using an
embedded broker and a Camel Context for consuming messages.  The problem I'm
having is that each time I produce a message and add it to it's ActiveMQ
destination Topic it appears that 10 messages go to the consumer.  I'm
basing this on printing out a message from a filter within camel each time
it receives a message.  Unfortunately, because I'm using the embedded broker
within spring, I don't appear to have access to any of the admin views (web
console or JConsole) that I would have with a dedicated broker.  Any help
would be greatly appreciated.  Here is my screen resources.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:amq="http://activemq.apache.org/schema/core"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://activemq.apache.org/schema/core
        http://activemq.apache.org/schema/core/activemq-core-5.3.1.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">


    <amq:broker brokerName="test-broker"
dataDirectory="/Users/steve/Documents/activemq/data" start="true">
        <!-- The transport connectors ActiveMQ will listen to -->
        <amq:transportConnectors>
            <amq:transportConnector name="openwire"
uri="tcp://localhost:61616"/>
        </amq:transportConnectors>
    </amq:broker>

    <!-- use jencks connection pooling so its more effecient to send JMS
messages -->
    <!--brokerURL="tcp://localhost:61616"-->
    <!--<amqpool:pool id="jmsConnectionFactory"
xmlns:amqpool="http://jencks.org/amqpool/2.2"
                  brokerURL="vm://localhost"
                  maxConnections="8"/>-->


    <!--  ActiveMQ destinations to use  -->
    <bean id="frontPageLayoutTopic"
class="org.apache.activemq.command.ActiveMQTopic" autowire="constructor">
        <constructor-arg value="frontPageLayoutTopic"/>
    </bean>
    <bean id="badgeReceivedTopic"
class="org.apache.activemq.command.ActiveMQTopic" autowire="constructor">
        <constructor-arg value="badgeReceivedTopic"/>
    </bean>
    <bean id="queueDestination"
class="org.apache.activemq.command.ActiveMQQueue" autowire="constructor"/>

    <bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory" ref="jmsFactory"/>
        <property name="transacted" value="false"/>
        <property name="concurrentConsumers" value="10"/>
    </bean>

    <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="jmsConfig"/>

    </bean>

    <!-- Spring JMS Template -->
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref local="jmsFactory"/>
        </property>
        <property name="defaultDestination" ref="queueDestination"/>
    </bean>

    <!-- a sample POJO which uses a Spring JmsTemplate -->
    <bean id="frontPageLayoutPublisher"
class="com.tweety.route.FrontPageLayoutProducer">
        <property name="jmsTemplate" ref="jmsTemplate"/>
        <property name="destination" ref="frontPageLayoutTopic"/>
    </bean>

    <bean id="frontPageBadgeProcessor"
class="com.tweety.route.FrontPageBadgeFilter"/>
    <bean id="twitterAuthenticationFilter"
class="com.tweety.route.TwitterAuthenticationFilter"/>
    <bean id="twitterPoser" class="com.tweety.route.TwitterPoster"/>

    <!-- a pooling based JMS provider -->
    <bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
        <property name="connectionFactory">
            <bean
class="org.apache.activemq.spring.ActiveMQConnectionFactory">
                <property name="brokerURL" value="vm://test-broker"/>
            </bean>
        </property>
    </bean>

    <bean id="frontPageLayoutToFrontPageBadgeProcess"
class="com.tweety.route.FrontPageLayoutToFrontPageBadgeProcess"/>
    <camelContext xmlns="http://camel.apache.org/schema/spring"
autoStartup="true">
        <routeBuilder ref="frontPageLayoutToFrontPageBadgeProcess"/>
    </camelContext>

</beans>

Thanks!
-Steve


-- 
View this message in context: http://old.nabble.com/Recieving-the-same-message-10-times%2C-Spring%2C-and-Camel-tp28300935p28300935.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message