001 /* 002 * Copyright 2009 Red Hat, Inc. 003 * Red Hat licenses this file to you under the Apache License, version 004 * 2.0 (the "License"); you may not use this file except in compliance 005 * with the License. You may obtain a copy of the License at 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * Unless required by applicable law or agreed to in writing, software 008 * distributed under the License is distributed on an "AS IS" BASIS, 009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 010 * implied. See the License for the specific language governing 011 * permissions and limitations under the License. 012 */ 013 014 package org.hornetq.api.jms.management; 015 016 import javax.management.MBeanOperationInfo; 017 018 import org.hornetq.api.core.management.Operation; 019 import org.hornetq.api.core.management.Parameter; 020 021 /** 022 * A DestinationControl is used to manage a JMS Destination. 023 * 024 * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a> 025 */ 026 public interface DestinationControl 027 { 028 // Attributes ---------------------------------------------------- 029 030 /** 031 * Returns the name of this destination. 032 */ 033 String getName(); 034 035 /** 036 * Returns the HornetQ address corresponding to this destination. 037 */ 038 String getAddress(); 039 040 /** 041 * Returns whether this destination is temporary. 042 */ 043 boolean isTemporary(); 044 045 /** 046 * Returns the number of messages currently in this destination. 047 */ 048 long getMessageCount() throws Exception; 049 050 /** 051 * Returns the number of messages that this queue is currently delivering to its consumers. 052 */ 053 int getDeliveringCount(); 054 055 /** 056 * Returns the number of messages added to this queue since it was created. 057 */ 058 long getMessagesAdded(); 059 060 // Operations ---------------------------------------------------- 061 062 /** 063 * Removed all the messages which matches the specified JMS filter from this destination. 064 * <br> 065 * Using {@code null} or an empty filter will remove <em>all</em> messages from this destination. 066 * 067 * @return the number of removed messages 068 */ 069 @Operation(desc = "Remove messages matching the given filter from the destination", impact = MBeanOperationInfo.ACTION) 070 int removeMessages(@Parameter(name = "filter", desc = "A JMS message filter (can be empty)") String filter) throws Exception; 071 072 }