001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker.jmx;
018
019import javax.management.openmbean.CompositeData;
020import javax.management.openmbean.OpenDataException;
021import javax.management.openmbean.TabularData;
022
023/**
024 * 
025 */
026public interface DurableSubscriptionViewMBean extends SubscriptionViewMBean {
027    /**
028     * @return name of the durable subscription name
029     */
030    @MBeanInfo("The subscription name.")
031    String getSubscriptionName();
032
033    /**
034     * Browse messages for this durable subscriber
035     * 
036     * @return messages
037     * @throws OpenDataException
038     */
039    @MBeanInfo("Browse the composite data array of pending messages in this subscription")
040    CompositeData[] browse() throws OpenDataException;
041
042    /**
043     * Browse messages for this durable subscriber
044     * 
045     * @return messages
046     * @throws OpenDataException
047     */
048    @MBeanInfo("Browse the tabular data of pending messages in this subscription")
049    TabularData browseAsTable() throws OpenDataException;
050
051    /**
052     * Destroys the durable subscription so that messages will no longer be
053     * stored for this subscription
054     */
055    @MBeanInfo("Destroy or delete this subscription")
056    void destroy() throws Exception;
057    
058    /**
059     * @return true if the message cursor has memory space available
060     * to page in more messages
061     */
062    @MBeanInfo("The subscription has space for more messages in memory")
063    public boolean doesCursorHaveSpace();
064    
065    /**
066     * @return true if the cursor has reached its memory limit for
067     * paged in messages
068     */
069    @MBeanInfo("The subscription cursor is full")
070    public boolean isCursorFull();
071    
072    /**
073     * @return true if the cursor has messages buffered to deliver
074     */
075    @MBeanInfo("The subscription cursor has messages in memory")
076    public boolean doesCursorHaveMessagesBuffered();
077    
078    /**
079     * @return the cursor memory usage in bytes
080     */
081    @MBeanInfo("The subscription cursor memory usage bytes")
082    public long getCursorMemoryUsage();
083    
084    /**
085     * @return the cursor memory usage as a percentage
086     */
087    @MBeanInfo("The subscription cursor memory usage %")
088    public int getCursorPercentUsage();
089    
090    /**
091     * @return the number of messages available to be paged in 
092     * by the cursor
093     */
094    @MBeanInfo("The subscription cursor size or message count")
095    public int cursorSize();
096
097    /**
098     * Removes a message from the durable subscription.
099     *
100     * @param messageId
101     * @throws Exception
102     */
103    @MBeanInfo("Remove a message from the subscription by JMS message ID.")
104    public void removeMessage(@MBeanInfo("messageId") String messageId) throws Exception;
105}