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 java.util.Map;
017
018 import javax.management.MBeanOperationInfo;
019
020 import org.hornetq.api.core.management.Operation;
021 import org.hornetq.api.core.management.Parameter;
022
023 /**
024 * A JMSQueueControl is used to manage a JMS queue.
025 *
026 * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
027 */
028 public interface JMSQueueControl extends DestinationControl
029 {
030 // Attributes ----------------------------------------------------
031
032 /**
033 * Returns the expiry address associated to this queue.
034 */
035 String getExpiryAddress();
036
037 /**
038 * Sets the expiry address associated to this queue to the specified expiryAddress.
039 */
040 void setExpiryAddress(@Parameter(name = "expiryAddress", desc = "Expiry address of the queue") String expiryAddress) throws Exception;
041
042 /**
043 * Returns the dead-letter address associated to this queue.
044 */
045 String getDeadLetterAddress();
046
047 /**
048 * Sets the dead-letter address associated to this queue to the specified deadLetterAddress.
049 */
050 void setDeadLetterAddress(@Parameter(name = "deadLetterAddress", desc = "Dead-letter address of the queue") String deadLetterAddress) throws Exception;
051
052 /**
053 * Returns the number of scheduled messages in this queue.
054 */
055 long getScheduledCount();
056
057 /**
058 * Returns the number of consumers consuming messages from this queue.
059 */
060 int getConsumerCount();
061
062 /**
063 * returns the selector for the queue
064 */
065 String getSelector();
066
067 // Operations ----------------------------------------------------
068
069 /**
070 * Returns the JNDI bindings associated to this connection factory.
071 */
072 @Operation(desc = "Returns the list of JNDI bindings associated")
073 String[] getJNDIBindings();
074
075 /**
076 * Add the JNDI binding to this destination
077 */
078 @Operation(desc = "Adds the queue to another JNDI binding")
079 void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
080
081 /**
082 * Lists all the JMS messages in this queue matching the specified filter.
083 * <br>
084 * 1 Map represents 1 message, keys are the message's properties and headers, values are the corresponding values.
085 * <br>
086 * Using {@code null} or an empty filter will list <em>all</em> messages from this queue.
087 */
088 @Operation(desc = "List all messages in the queue which matches the filter", impact = MBeanOperationInfo.INFO)
089 Map<String, Object>[] listMessages(@Parameter(name = "filter", desc = "A JMS Message filter") String filter) throws Exception;
090
091 /**
092 * Lists all the JMS messages in this queue matching the specified filter using JSON serialization.
093 * <br>
094 * Using {@code null} or an empty filter will list <em>all</em> messages from this queue.
095 */
096 @Operation(desc = "List all messages in the queue which matches the filter and return them using JSON", impact = MBeanOperationInfo.INFO)
097 String listMessagesAsJSON(@Parameter(name = "filter", desc = "A JMS Message filter (can be empty)") String filter) throws Exception;
098
099 /**
100 * Counts the number of messages in this queue matching the specified filter.
101 * <br>
102 * Using {@code null} or an empty filter will count <em>all</em> messages from this queue.
103 */
104 @Operation(desc = "Returns the number of the messages in the queue matching the given filter", impact = MBeanOperationInfo.INFO)
105 long countMessages(@Parameter(name = "filter", desc = "A JMS message filter (can be empty)") String filter) throws Exception;
106
107 /**
108 * Removes the message corresponding to the specified message ID.
109 *
110 * @return {@code true} if the message was removed, {@code false} else
111 */
112 @Operation(desc = "Remove the message corresponding to the given messageID", impact = MBeanOperationInfo.ACTION)
113 boolean removeMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID) throws Exception;
114
115 /**
116 * Removes all the message corresponding to the specified filter.
117 * <br>
118 * Using {@code null} or an empty filter will remove <em>all</em> messages from this queue.
119 *
120 * @return the number of removed messages
121 */
122 @Operation(desc = "Remove the messages corresponding to the given filter (and returns the number of removed messages)", impact = MBeanOperationInfo.ACTION)
123 int removeMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
124
125 /**
126 * Expires all the message corresponding to the specified filter.
127 * <br>
128 * Using {@code null} or an empty filter will expire <em>all</em> messages from this queue.
129 *
130 * @return the number of expired messages
131 */
132 @Operation(desc = "Expire the messages corresponding to the given filter (and returns the number of expired messages)", impact = MBeanOperationInfo.ACTION)
133 int expireMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
134
135 /**
136 * Expires the message corresponding to the specified message ID.
137 *
138 * @return {@code true} if the message was expired, {@code false} else
139 */
140 @Operation(desc = "Expire the message corresponding to the given messageID", impact = MBeanOperationInfo.ACTION)
141 boolean expireMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID) throws Exception;
142
143 /**
144 * Sends the message corresponding to the specified message ID to this queue's dead letter address.
145 *
146 * @return {@code true} if the message was sent to the dead letter address, {@code false} else
147 */
148 @Operation(desc = "Send the message corresponding to the given messageID to this queue's Dead Letter Address", impact = MBeanOperationInfo.ACTION)
149 boolean sendMessageToDeadLetterAddress(@Parameter(name = "messageID", desc = "A message ID") String messageID) throws Exception;
150
151 /**
152 * Sends all the message corresponding to the specified filter to this queue's dead letter address.
153 * <br>
154 * Using {@code null} or an empty filter will send <em>all</em> messages from this queue.
155 *
156 * @return the number of sent messages
157 */
158 @Operation(desc = "Send the messages corresponding to the given filter to this queue's Dead Letter Address", impact = MBeanOperationInfo.ACTION)
159 int sendMessagesToDeadLetterAddress(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filterStr) throws Exception;
160
161 /**
162 * Changes the message's priority corresponding to the specified message ID to the specified priority.
163 *
164 * @param newPriority between 0 and 9 inclusive.
165 *
166 * @return {@code true} if the message priority was changed
167 */
168 @Operation(desc = "Change the priority of the message corresponding to the given messageID", impact = MBeanOperationInfo.ACTION)
169 boolean changeMessagePriority(@Parameter(name = "messageID", desc = "A message ID") String messageID,
170 @Parameter(name = "newPriority", desc = "the new priority (between 0 and 9)") int newPriority) throws Exception;
171
172 /**
173 * Changes the priority for all the message corresponding to the specified filter to the specified priority.
174 * <br>
175 * Using {@code null} or an empty filter will change <em>all</em> messages from this queue.
176 *
177 * @return the number of changed messages
178 */
179 @Operation(desc = "Change the priority of the messages corresponding to the given filter", impact = MBeanOperationInfo.ACTION)
180 int changeMessagesPriority(@Parameter(name = "filter", desc = "A message filter") String filter,
181 @Parameter(name = "newPriority", desc = "the new priority (between 0 and 9)") int newPriority) throws Exception;
182 /**
183 * Moves the message corresponding to the specified message ID to the specified other queue.
184 *
185 * @return {@code true} if the message was moved, {@code false} else
186 */
187 @Operation(desc = "Move the message corresponding to the given messageID to another queue, ignoring duplicates (rejectDuplicates=false on this case)", impact = MBeanOperationInfo.ACTION)
188 boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID,
189 @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName) throws Exception;
190
191
192 /**
193 * Moves the message corresponding to the specified message ID to the specified other queue.
194 *
195 * @return {@code true} if the message was moved, {@code false} else
196 */
197 @Operation(desc = "Move the message corresponding to the given messageID to another queue", impact = MBeanOperationInfo.ACTION)
198 boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID,
199 @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName,
200 @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
201
202 /**
203 * Moves all the message corresponding to the specified filter to the specified other queue.
204 * RejectDuplicates=false on this case
205 * <br>
206 * Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
207 *
208 * @return the number of moved messages
209 */
210 @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages). rejectDuplicates=false on this case", impact = MBeanOperationInfo.ACTION)
211 int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
212 @Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName) throws Exception;
213
214 /**
215 * Moves all the message corresponding to the specified filter to the specified other queue.
216 * <br>
217 * Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
218 *
219 * @return the number of moved messages
220 */
221 @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
222 int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
223 @Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName,
224 @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
225
226 /**
227 * Lists the message counter for this queue.
228 */
229 @Operation(desc = "List the message counters", impact = MBeanOperationInfo.INFO)
230 String listMessageCounter() throws Exception;
231
232 /**
233 * Resets the message counter for this queue.
234 */
235 @Operation(desc = "Reset the message counters", impact = MBeanOperationInfo.INFO)
236 void resetMessageCounter() throws Exception;
237
238 /**
239 * Lists the message counter for this queue as a HTML table.
240 */
241 @Operation(desc = "List the message counters as HTML", impact = MBeanOperationInfo.INFO)
242 String listMessageCounterAsHTML() throws Exception;
243
244 /**
245 * Lists the message counter history for this queue.
246 */
247 @Operation(desc = "List the message counters history", impact = MBeanOperationInfo.INFO)
248 String listMessageCounterHistory() throws Exception;
249
250 /**
251 * Lists the message counter history for this queue as a HTML table.
252 */
253 @Operation(desc = "List the message counters history as HTML", impact = MBeanOperationInfo.INFO)
254 String listMessageCounterHistoryAsHTML() throws Exception;
255
256 /**
257 * Pauses the queue. Messages are no longer delivered to its consumers.
258 */
259 @Operation(desc = "Pause the queue.", impact = MBeanOperationInfo.ACTION)
260 void pause() throws Exception;
261
262 /**
263 * Returns whether the queue is paused.
264 */
265 @Operation(desc = "Returns true if the queue is paused.", impact = MBeanOperationInfo.INFO)
266 boolean isPaused() throws Exception;
267
268 /**
269 * Resumes the queue. Messages are again delivered to its consumers.
270 */
271 @Operation(desc = "Resume the queue.", impact = MBeanOperationInfo.ACTION)
272 void resume() throws Exception;
273
274 @Operation(desc = "List all the existent consumers on the Queue")
275 String listConsumersAsJSON() throws Exception;
276
277 }