activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuconic <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #960: ARTEMIS-921 Consumers killed as slow eve...
Date Mon, 16 Jan 2017 14:26:36 GMT
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/960#discussion_r96239419
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleSlowConsumerTest.java
---
    @@ -0,0 +1,261 @@
    +/*
    + * 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.
    + */
    +package org.apache.activemq.artemis.tests.integration.client;
    +
    +import org.apache.activemq.artemis.api.core.ActiveMQException;
    +import org.apache.activemq.artemis.api.core.SimpleString;
    +import org.apache.activemq.artemis.api.core.client.ClientConsumer;
    +import org.apache.activemq.artemis.api.core.client.ClientMessage;
    +import org.apache.activemq.artemis.api.core.client.ClientProducer;
    +import org.apache.activemq.artemis.api.core.client.ClientSession;
    +import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
    +import org.apache.activemq.artemis.api.core.client.ServerLocator;
    +import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.RoutingType;
    +import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
    +import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
    +import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
    +import org.apache.activemq.artemis.utils.ConcurrentHashSet;
    +import org.apache.activemq.artemis.utils.TimeUtils;
    +import org.junit.Before;
    +import org.junit.Test;
    +
    +import java.util.Set;
    +
    +public class MultipleSlowConsumerTest extends ActiveMQTestBase {
    +
    +   private int checkPeriod = 3;
    +   private int threshold = 1;
    +
    +   private ActiveMQServer server;
    +
    +   private final SimpleString QUEUE = new SimpleString("SlowConsumerTestQueue");
    +
    +   private ServerLocator locator;
    +
    +   @Before
    +   @Override
    +   public void setUp() throws Exception {
    +      super.setUp();
    +
    +      server = createServer(true, true);
    +
    +      AddressSettings addressSettings = new AddressSettings();
    +      addressSettings.setSlowConsumerCheckPeriod(checkPeriod);
    +      addressSettings.setSlowConsumerThreshold(threshold);
    +      addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.KILL);
    +
    +      server.start();
    +
    +      server.getAddressSettingsRepository().addMatch(QUEUE.toString(), addressSettings);
    +
    +      server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false);
    +
    +      locator = createFactory(true);
    +   }
    +
    +   /**
    +    * This test creates 3 consumers on one queue. A producer sends
    +    * messages at a rate of 2 mesages per second. Each consumer
    +    * consumes messages at rate of 1 message per second. The slow
    +    * consumer threshold is 1 message per second.
    +    * Based on the above settings, at least one of the consumers
    +    * will be removed during the test, but at least one of the
    +    * consumers will remain and all messages will be received.
    +    */
    +   @Test
    +   public void testMultipleConsumersOneQueue() throws Exception {
    --- End diff --
    
    Please move this test to SlowConsumerTest...
    
    That test run in Page and non paging mode.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message