Hello,

what acknoledge mode did you use? Session.AUTO_ACKNOWLEDGE?
try to use Session.CLIENT_ACKNOWLEDGE an then send the ACK manualy.

I think when the client is closed. He has not send back the ACK for the
actual Message. If there is no ACK for the Message then it will be
redelivered.

I`t would be fine if you can provide a junit-test for the Problem.

regards
Marco


kloh wrote:
> 
> Hi *,
> 
> we're concerning with interested happenings, about which we're not sure,
> wether this is caused by bad configuration, bad code or a bug.
> 
> The scenario:
> ActiveMQ 5.1, persistence with the amq-store, transactional.
> We have two producer, each sends 10.000 messages to the broker, to a
> queue. We have 3 consumers; one of this consumers is closed every 5
> seconds and a new consumer is created and started. Each consumer just
> counts the messages it recieved and commits.
> 
> What happens?
> After the consumers don't recieve any messages, we take a look at the
> web-console or the jmx-monitor and see, that the pending messages are
> negative (about 3 to 5) and the recieved messages are not 20.000 but
> 20.005 (for example).
> 
> We just tried differents variants of closing the consumer, but the calls
> --
> consumer.close()
> session.close()
> --
> should work. Or did we not get the point at this?
> 
> The configuration:
> <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://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   
>   http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>
> 
>     <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> 
>     <broker xmlns="http://activemq.apache.org/schema/core";
> brokerName="localhost" useJmx="true" persistent="true"
> dataDirectory="${activemq.base}/data">
> 
>         <destinationPolicy>
>             <policyMap>
>                 <policyEntries>
>                     <policyEntry queue=">" producerFlowControl="true"
> memoryLimit="50mb"/>
>                     <policyEntry topic=">" memoryLimit="5mb">
>                         <dispatchPolicy>
>                             <strictOrderDispatchPolicy/>
>                         </dispatchPolicy>
>                         <subscriptionRecoveryPolicy>
>                             <lastImageSubscriptionRecoveryPolicy/>
>                         </subscriptionRecoveryPolicy>
>                     </policyEntry>
>                 </policyEntries>
>             </policyMap>
>         </destinationPolicy>
> 
>         <managementContext>
>             <managementContext connectorPort="1099"
> jmxDomainName="org.apache.activemq"/>
>         </managementContext>
> 
>         <networkConnectors>
>             <networkConnector name="default-nc"
> uri="multicast://default"/>
>         </networkConnectors>
> 
>       <persistenceAdapter>
>             <amqPersistenceAdapter syncOnWrite="false"
> directory="${activemq.base}/data" maxFileLength="20 mb"/>
>         </persistenceAdapter>
> 
>         <systemUsage>
>             <systemUsage>
>                 <memoryUsage>
>                     <memoryUsage limit="100 mb"/> 
>                 </memoryUsage>
>                 <storeUsage>
>                     <storeUsage limit="1 gb" name="messageStorage"/>
>                 </storeUsage>
>                 <tempUsage>
>                     <tempUsage limit="100 mb"/>
>                 </tempUsage>
>             </systemUsage>
>         </systemUsage>
> 
>         <transportConnectors>
>             <transportConnector name="openwire"
> uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
>         </transportConnectors>
> 
>     </broker>
>    
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring";>
>         <package>org.foo.bar</package>
>     </camelContext>
> 
>     <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"/>
>             <webAppContext contextPath="/fileserver"
> resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true"/>
>         </handlers>
>     </jetty>
> 
>     <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
>       <property name="databaseName" value="derbydb"/>
>       <property name="createDatabase" value="create"/>
>     </bean>
> </beans>
> <!-- END SNIPPET: example -->
> 
> We are interested, if someone else has occured this or there is just one
> (simple) point, that we miss.
> 

-- 
View this message in context: 
http://www.nabble.com/Closing-a-consumer-create-more-messages-than-sent-tp17602690s2354p17619080.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to