[ 
https://issues.apache.org/jira/browse/ARTEMIS-2401?focusedWorklogId=267264&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-267264
 ]

ASF GitHub Bot logged work on ARTEMIS-2401:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Jun/19 05:11
            Start Date: 26/Jun/19 05:11
    Worklog Time Spent: 10m 
      Work Description: brusdev commented on pull request #2731: 
[ARTEMIS-2401]: Implement the Pause method for a Topic
URL: https://github.com/apache/activemq-artemis/pull/2731#discussion_r297486077
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
 ##########
 @@ -373,6 +371,58 @@ public String sendMessage(final Map<String, String> 
headers,
       return MBeanInfoHelper.getMBeanAttributesInfo(AddressControl.class);
    }
 
+   @Override
+   public void pauseConsumers() throws Exception {
+      if (AuditLogger.isEnabled()) {
+         AuditLogger.pause(addressInfo);
+      }
+      checkStarted();
+
+      clearIO();
+      try {
+         if (!addressInfo.isPaused()) {
+            addressInfo.pauseConsumers();
+            Bindings bindings = 
server.getPostOffice().lookupBindingsForAddress(addressInfo.getName());
+            if (bindings != null) {
+               for (Binding binding : bindings.getBindings()) {
+                  if (binding instanceof QueueBinding) {
+                     QueueControl coreQueueControl = (QueueControl) 
managementService.getResource(ResourceNames.QUEUE + 
binding.getUniqueName().toString());
+                     coreQueueControl.pause();
 
 Review comment:
   I have a little concern here and in resumeConsumers. In a case with many 
bindings one of related queues could be deleted during the iteration and 
coreQueueControl could be null. Adding a check on coreQueueControl before to 
call coreQueueControl.pause should avoid to interrupt the iteration for a 
NullPointerException.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 267264)
    Time Spent: 50m  (was: 40m)

> Implement the Pause method for a Topic
> --------------------------------------
>
>                 Key: ARTEMIS-2401
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2401
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 2.9.0
>            Reporter: Emmanuel Hugonnet
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Enable to pause all the consumers of a topic. New subscriptions being 
> registered while the topic is in pause will be paused also.



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

Reply via email to