[ 
https://issues.apache.org/jira/browse/ARTEMIS-2097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649954#comment-16649954
 ] 

ASF GitHub Bot commented on ARTEMIS-2097:
-----------------------------------------

Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2371#discussion_r225093373
  
    --- Diff: 
artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQAddressBlockedException.java
 ---
    @@ -0,0 +1,24 @@
    +/*
    + * 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.api.core;
    +
    +public class ActiveMQAddressBlockedException extends ActiveMQException {
    +
    +   public ActiveMQAddressBlockedException(String address) {
    --- End diff --
    
    To help the JVM to handle this exception like a "common" case (and not 
exceptional): i suggest to disable the stack trace generation for this 
exception by adding:
    ```
        @Override
        public Throwable fillInStackTrace() {
            return this;
        } 
    ```
    That would allow to create `ActiveMQAddressBlockedException` as a singleton 
and just reusing it a signal.
    
    I'm assuming that the use case for pause/block producers is making 
intensive use of this exception as an event that allow recovering and deciding 
what to do next in the common execution path.


> Pause and Block Producers
> -------------------------
>
>                 Key: ARTEMIS-2097
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2097
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 1.5.5
>         Environment: AMQ-1.5.5
>            Reporter: Tyronne Wickramarathne
>            Assignee: Howard Gao
>            Priority: Major
>             Fix For: unscheduled
>
>
> Could it be possible to block all incoming messages without changing the 
> address-full-policy to 'BLOCK'?
> The address full policy can be configured to block incoming messages should 
> the address full policy reaches the configured max-size-bytes attributes.
> However, on certain circumstances it is important to make a JMS destination 
> drain without accepting incoming messages while keeping the 
> address-full-policy at 'PAGE'. For an instance, if a user needs to bring down 
> the broker for maintenance, it is important to allow the user to drain 
> existing messages in the corresponding destination without accepting any new 
> messages.
>  
> Currently the pause() method on a destination pauses message consumers. In a 
> similar fashion could it be possible to add a new method to block message 
> producers on a given destination irrespective of the address-full-policy 
> being used?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to