Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 46B11200BFE for ; Mon, 16 Jan 2017 15:26:38 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 45498160B30; Mon, 16 Jan 2017 14:26:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8EEA7160B22 for ; Mon, 16 Jan 2017 15:26:37 +0100 (CET) Received: (qmail 17162 invoked by uid 500); 16 Jan 2017 14:26:36 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 17150 invoked by uid 99); 16 Jan 2017 14:26:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 14:26:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4275ADFC16; Mon, 16 Jan 2017 14:26:36 +0000 (UTC) From: clebertsuconic To: dev@activemq.apache.org Reply-To: dev@activemq.apache.org References: In-Reply-To: Subject: [GitHub] activemq-artemis pull request #960: ARTEMIS-921 Consumers killed as slow eve... Content-Type: text/plain Message-Id: <20170116142636.4275ADFC16@git1-us-west.apache.org> Date: Mon, 16 Jan 2017 14:26:36 +0000 (UTC) archived-at: Mon, 16 Jan 2017 14:26:38 -0000 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. ---