[jboss-cvs] JBoss Messaging SVN: r3855 - in trunk: src/main/org/jboss/messaging/core/management and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 10 10:35:19 EDT 2008
Author: ataylor
Date: 2008-03-10 10:35:18 -0400 (Mon, 10 Mar 2008)
New Revision: 3855
Modified:
trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedExample.java
trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedManagementExample.java
trunk/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java
trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java
trunk/src/main/org/jboss/messaging/core/message/MessageReference.java
trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java
trunk/src/main/org/jboss/messaging/core/server/Queue.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/src/org/jboss/test/messaging/jms/server/JMSServerManagerTest.java
Log:
management interface more updates plus added javadocs
Modified: trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedExample.java
===================================================================
--- trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedExample.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedExample.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.impl.MessageImpl;
-import org.jboss.messaging.core.remoting.impl.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.impl.RemotingConfigurationImpl;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.impl.MessagingServerImpl;
import org.jboss.messaging.jms.client.JBossTextMessage;
@@ -43,12 +43,12 @@
{
public static void main(String args[]) throws Exception
{
- RemotingConfiguration remotingConf = new RemotingConfiguration(TCP, "localhost", 5400);
+ RemotingConfigurationImpl remotingConf = new RemotingConfigurationImpl(TCP, "localhost", 5400);
MessagingServer messagingServer = new MessagingServerImpl(remotingConf);
messagingServer.start();
- ClientConnectionFactory cf = new ClientConnectionFactoryImpl(messagingServer.getConfiguration().getMessagingServerID(),
- messagingServer.getConfiguration().getRemotingConfiguration(), messagingServer.getVersion(), messagingServer.getConfiguration().isStrictTck(), 500);ClientConnection clientConnection = cf.createConnection(null, null);
- ClientSession clientSession = clientConnection.createClientSession(false, true, true, 0, false);
+ ClientConnectionFactory cf = new ClientConnectionFactoryImpl(0, remotingConf, messagingServer.getVersion());
+ ClientConnection clientConnection = cf.createConnection(null, null);
+ ClientSession clientSession = clientConnection.createClientSession(false, true, true, 0, false, false);
clientSession.createQueue("Queue1", "Queue1", null, false, false);
ClientProducer clientProducer = clientSession.createProducer("Queue1");
Modified: trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedManagementExample.java
===================================================================
--- trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedManagementExample.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/docs/examples/embedded/src/org/jboss/example/embedded/EmbeddedManagementExample.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -21,11 +21,12 @@
*/
package org.jboss.example.embedded;
-import org.jboss.messaging.core.remoting.impl.RemotingConfiguration;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.impl.MessagingServerImpl;
import static org.jboss.messaging.core.remoting.TransportType.TCP;
+import org.jboss.messaging.core.remoting.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.impl.RemotingConfigurationImpl;
import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.management.impl.MessagingServerManagementImpl;
import org.jboss.messaging.jms.server.JMSServerManager;
@@ -56,7 +57,7 @@
mainMBean.setRmiBindAddress("localhost");
mainMBean.setNamingInfo(namingBean);
mainMBean.start();
- RemotingConfiguration remotingConf = new RemotingConfiguration(TCP, "localhost", 5400);
+ RemotingConfigurationImpl remotingConf = new RemotingConfigurationImpl(TCP, "localhost", 5400);
remotingConf.setInvmDisabled(true);
MessagingServer messagingServer = new MessagingServerImpl(remotingConf);
messagingServer.start();
Modified: trunk/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -33,76 +33,239 @@
import org.jboss.messaging.core.server.ServerConnection;
/**
- * This interface describes the management interface exposed by the server
+ * This interface describes the core management interface exposed by the server
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
*/
public interface MessagingServerManagement
{
+ /**
+ * is the server started
+ * @return true if the server is running
+ */
boolean isStarted();
+ /**
+ * creates a queue with the specified address
+ * @param address the address
+ * @param name the name of the queue
+ * @throws Exception if a problem occurred
+ */
void createQueue(String address,String name) throws Exception;
+ /**
+ * destroy a particular queue
+ * @param name the name of the queue
+ * @throws Exception if a problem occurred
+ */
void destroyQueue(String name) throws Exception;
-
+
+ /**
+ * add an address to the post office
+ * @param address the address to add
+ * @return true if the address was added
+ * @throws Exception if a problem occurred
+ */
boolean addAddress(String address) throws Exception;
+ /**
+ * remove an address from the post office
+ * @param address the address to remove
+ * @return true if the address was removed
+ * @throws Exception if a problem occurred
+ */
boolean removeAddress(String address) throws Exception;
-
+
+ /**
+ * returns all the queues for a specific address
+ * @param address the address
+ * @return the queues
+ * @throws Exception if a problem occurred
+ */
List<Queue> getQueuesForAddress(String address) throws Exception;
+ /**
+ * create a client connection factory
+ * @param strictTck if it is strict TCK
+ * @param consumerWindowSize the consumer window size
+ * @param consumerMaxRate the consumer max rate
+ * @param producerWindowSize the producer window size
+ * @param producerMaxRate the producer max rate
+ * @return the connection factory
+ */
ClientConnectionFactory createClientConnectionFactory(boolean strictTck,
int consumerWindowSize, int consumerMaxRate, int producerWindowSize, int producerMaxRate);
+ /**
+ * remove all the messages for a specific address
+ * @param address the address
+ * @throws Exception if a problem occurred
+ */
void removeAllMessagesForAddress(String address) throws Exception;
+ /**
+ * remove all the messages for a specific binding
+ * @param name the name of the binding
+ * @throws Exception if a problem occurred
+ */
void removeAllMessagesForBinding(String name) throws Exception;
- List<Message> listMessages(String queueName, Filter filter) throws Exception;
+ /**
+ * List all messages in a queue that match the filter provided
+ * @param queue the name of the queue
+ * @param filter the filter
+ * @return the messages
+ * @throws Exception if a problem occurred
+ */
+ List<Message> listMessages(String queue, Filter filter) throws Exception;
+ /**
+ * remove the messages for a specific binding that match the specified filter
+ * @param binding the name of the binding
+ * @param filter the filter
+ * @throws Exception if a problem occurred
+ */
void removeMessageForBinding(String binding, Filter filter) throws Exception;
- void removeMessageForAddress(String binding, Filter filter) throws Exception;
+ /**
+ * remove the messages for a specific address that match the specified filter
+ * @param address the address
+ * @param filter the filter
+ * @throws Exception if a problem occurred
+ */
+ void removeMessageForAddress(String address, Filter filter) throws Exception;
+ /**
+ * count the number of messages in a queue
+ * @param queue the name of the queue
+ * @return the number of messages in a queue
+ * @throws Exception if a problem occurred
+ */
int getMessageCountForQueue(String queue) throws Exception;
- void registerMessageCounter(String queueName) throws Exception;
+ /**
+ * register a message counter with a specific queue
+ * @param queue the name of the queue
+ * @throws Exception if a problem occurred
+ */
+ void registerMessageCounter(String queue) throws Exception;
- void unregisterMessageCounter(String queueName) throws Exception;
+ /**
+ * unregister a message counter from a specific queue
+ * @param queue the name of the queue
+ * @throws Exception if a problem occurred
+ */
+ void unregisterMessageCounter(String queue) throws Exception;
- void startMessageCounter(String queueName, long duration) throws Exception;
+ /**
+ * start collection statistics on a message counter. The message counter must have been registered first.
+ * @param queue the name of the queue
+ * @param duration how long to take a sample for in seconds. 0 means indefinitely.
+ * @throws Exception if a problem occurred
+ */
+ void startMessageCounter(String queue, long duration) throws Exception;
- MessageCounter stopMessageCounter(String queueName) throws Exception;
+ /**
+ * stop a message counter on a specific queue. The message counter must be started to call this.
+ * @param queue the name of the queue
+ * @return the message counter stopped
+ * @throws Exception if a problem occurred
+ */
+ MessageCounter stopMessageCounter(String queue) throws Exception;
- MessageCounter getMessageCounter(String queueName);
+ /**
+ * get a message counter for a specific queue
+ * @param queue the name of the queue
+ * @return the message counter
+ */
+ MessageCounter getMessageCounter(String queue);
+ /**
+ * get all message counters
+ * @return the message counters
+ */
Collection<MessageCounter> getMessageCounters();
+ /**
+ * reset a message counter for a specific queue
+ * @param queue the name of the queue
+ */
void resetMessageCounter(String queue);
+ /**
+ * reset all message counters registered
+ */
void resetMessageCounters();
+ /**
+ * reset the history for a message counter for a queue
+ * @param queue the name of the queue
+ */
void resetMessageCounterHistory(String queue);
+ /**
+ * reset all message counter histories
+ */
void resetMessageCounterHistories();
+ /**
+ * stop all message counters
+ * @return all message counters
+ * @throws Exception if a problem occurred
+ */
List<MessageCounter> stopAllMessageCounters() throws Exception;
+ /**
+ * unregister all message counters
+ * @throws Exception if a problem occurred
+ */
void unregisterAllMessageCounters() throws Exception;
+ /**
+ * get the number of consumers for a specific queue
+ * @param queue the name of the queue
+ * @return the count
+ * @throws Exception if a problem occurred
+ */
public int getConsumerCountForQueue(String queue) throws Exception;
+ /**
+ * return all the active connections
+ * @return all connections
+ */
List<ServerConnection> getActiveConnections();
+ /**
+ * move a set of messages from one queue to another
+ * @param toQueue the source queue
+ * @param fromQueue the destination queue
+ * @param filter the filter to use
+ * @throws Exception if a problem occurred
+ */
void moveMessages(String toQueue, String fromQueue, String filter) throws Exception;
+ /**
+ * expire a set of messages for a specific queue
+ * @param queue the name of the queue
+ * @param filter the filter to use
+ * @throws Exception if a problem occurred
+ */
void expireMessages(String queue,String filter) throws Exception;
+ /**
+ * change the message priority for a set of messages
+ * @param queue the name of the queue
+ * @param filter the filter to use
+ * @param priority the priority to change to
+ * @throws Exception if a problem occurred
+ */
void changeMessagePriority(String queue, String filter, int priority) throws Exception;
- void changeMessageHeader(String queue, String filter, String header, Object value) throws Exception;
-
+ /**
+ * list all available addresses
+ * @return the addresses
+ */
Set<String> listAvailableAddresses();
}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -426,10 +426,10 @@
Filter actFilter = new FilterImpl(filter);
Queue from = getQueue(fromQueue);
Queue to = getQueue(toQueue);
- List<MessageReference> messageReferences = from.removeReferences(actFilter);
+ List<MessageReference> messageReferences = from.list(actFilter);
for (MessageReference messageReference : messageReferences)
{
- to.addLast(messageReference);
+ from.move(messageReference, to, messagingServer.getPersistenceManager());
}
}
@@ -437,10 +437,10 @@
public void expireMessages(String queue, String filter) throws Exception
{
Filter actFilter = new FilterImpl(filter);
- List<MessageReference> allRefs = getQueue(queue).removeReferences(actFilter);
+ List<MessageReference> allRefs = getQueue(queue).list(actFilter);
for (MessageReference messageReference : allRefs)
{
- messageReference.expire(messagingServer.getPersistenceManager(), messagingServer.getQueueSettingsRepository());
+ messageReference.getMessage().setExpiration(System.currentTimeMillis());
}
}
@@ -460,19 +460,6 @@
}
- public void changeMessageHeader(String queue, String filter, String header, Object value) throws Exception
- {
- Filter actFilter = new FilterImpl(filter);
- List<MessageReference> allRefs = getQueue(queue).list(actFilter);
- for (MessageReference reference : allRefs)
- {
- if(reference.getMessage().removeHeader(header) != null)
- {
- reference.getMessage().putHeader(header, value);
- }
- }
- }
-
public Set<String> listAvailableAddresses()
{
return messagingServer.getPostOffice().listAvailableAddresses();
Modified: trunk/src/main/org/jboss/messaging/core/message/MessageReference.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/MessageReference.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/message/MessageReference.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -70,6 +70,9 @@
boolean cancel(PersistenceManager persistenceManager, HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception;
void expire(PersistenceManager persistenceManager, HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception;
+
+ void moveMessage(Queue destinationQueue,
+ PersistenceManager persistenceManager) throws Exception;
}
Modified: trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -187,7 +187,21 @@
acknowledge(persistenceManager);
}
}
-
+
+ public void moveMessage(final Queue destinationQueue,
+ final PersistenceManager persistenceManager) throws Exception
+ {
+ TransactionImpl tx = new TransactionImpl();
+
+ message.createReference(destinationQueue);
+
+ tx.addMessage(message);
+
+ tx.addAcknowledgement(this);
+
+ tx.commit(true, persistenceManager);
+ }
+
// Public --------------------------------------------------------
public String toString()
Modified: trunk/src/main/org/jboss/messaging/core/server/Queue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/Queue.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/server/Queue.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -27,6 +27,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.postoffice.FlowController;
+import org.jboss.messaging.core.persistence.PersistenceManager;
/**
@@ -68,8 +69,6 @@
void changePriority(final MessageReference messageReference, int priority);
- List<MessageReference> removeReferences(Filter filter);
-
long getPersistenceID();
void setPersistenceID(long id);
@@ -109,4 +108,6 @@
FlowController getFlowController();
void setFlowController(FlowController flowController);
+
+ void move(MessageReference messageReference, Queue queue, PersistenceManager persistenceManager) throws Exception;
}
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -37,11 +37,14 @@
import org.jboss.messaging.core.list.impl.PriorityLinkedListImpl;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.postoffice.FlowController;
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.DistributionPolicy;
import org.jboss.messaging.core.server.HandleStatus;
import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.transaction.impl.TransactionImpl;
+import org.jboss.messaging.core.persistence.PersistenceManager;
/**
*
@@ -230,6 +233,18 @@
}
}
+ public void move(MessageReference messageReference, Queue queue, PersistenceManager persistenceManager) throws Exception
+ {
+ Message newMessage = messageReference.getMessage().copy();
+ MessageReference newRef = newMessage.createReference(queue);
+ queue.addLast(newRef);
+ messageReferences.remove(messageReference , messageReference.getMessage().getPriority());
+ TransactionImpl tx = new TransactionImpl();
+ tx.addMessage(newMessage);
+ tx.addAcknowledgement(messageReference);
+ tx.commit(true, persistenceManager);
+ }
+
public synchronized void addConsumer(final Consumer consumer)
{
consumers.add(consumer);
@@ -310,19 +325,6 @@
//FIXME - what about scheduled??
}
- //FIXME - review this
- public synchronized List<MessageReference> removeReferences(final Filter filter)
- {
- List<MessageReference> allRefs = list(filter);
-
- for (MessageReference messageReference : allRefs)
- {
- removeReference(messageReference);
- }
-
- return allRefs;
- }
-
public long getPersistenceID()
{
return persistenceID;
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -13,101 +13,364 @@
*/
public interface JMSServerManager extends Serializable
{
- // management operations
public enum ListType
{
ALL, DURABLE, NON_DURABLE
}
+ /**
+ * Has the Server been started.
+ * @return true if the server us running
+ */
boolean isStarted();
+ /**
+ * Creates a JMS Queue.
+ * @param queueName The name of the queue to create
+ * @param jndiBinding the name of the binding for JNDI
+ * @return true if the queue is created or if it existed and was added to JNDI
+ * @throws Exception if problems were encountered creating the queue.
+ */
boolean createQueue(String queueName, String jndiBinding) throws Exception;
+ /**
+ * Creates a JMS Topic
+ * @param topicName the name of the topic
+ * @param jndiBinding the name of the binding for JNDI
+ * @return true if the topic was created or if it existed and was added to JNDI
+ * @throws Exception if a problem occurred creating the topic
+ */
boolean createTopic(String topicName, String jndiBinding) throws Exception;
+ /**
+ * destroys a queue and removes it from JNDI
+ * @param name the name of the queue to destroy
+ * @return true if destroyed
+ * @throws Exception if a problem occurred destroying the queue
+ */
boolean destroyQueue(String name) throws Exception;
+ /**
+ * destroys a topic and removes it from JNDI
+ * @param name the name of the topic to destroy
+ * @return true if the topic was destroyed
+ * @throws Exception if a problem occurred destroying the topic
+ */
boolean destroyTopic(String name) throws Exception;
+ /**
+ * returns a list of all the JMS queues
+ * @return all queues
+ */
Set<String> listAllQueues();
+ /**
+ * returns a list of all the JMS topics
+ * @return all topics
+ */
Set<String> listAllTopics();
+ /**
+ * returns all the temporary destinations
+ * @return all temporary destinations
+ */
Set<String> listTemporaryDestinations();
+ /**
+ * Creates a connection factory
+ * @param name the name of this connection factory
+ * @param clientID the client id
+ * @param dupsOKBatchSize the bath size
+ * @param strictTck Whether it is strict TCK or not
+ * @param consumerWindowSize The consumer window size
+ * @param consumerMaxRate the Consumer max rate
+ * @param producerWindowSize the producer window size
+ * @param producerMaxRate the producer max rate
+ * @param jndiBinding the binding name for JNDI
+ * @return true if the connection factory was created
+ * @throws Exception if a problem occurred creating the connection factory
+ */
boolean createConnectionFactory(String name, String clientID,
int dupsOKBatchSize, boolean strictTck,
int consumerWindowSize, int consumerMaxRate,
int producerWindowSize, int producerMaxRate,
String jndiBinding) throws Exception;
+ /**
+ * Creates a connection factory
+ * @param name the name of this connection factory
+ * @param clientID the client id
+ * @param dupsOKBatchSize the bath size
+ * @param strictTck Whether it is strict TCK or not
+ * @param consumerWindowSize The consumer window size
+ * @param consumerMaxRate the Consumer max rate
+ * @param producerWindowSize the producer window size
+ * @param producerMaxRate the producer max rate
+ * @param jndiBindings the binding names for JNDI
+ * @return true if the connection factory was created
+ * @throws Exception if a problem occurred creating the connection factory
+ */
boolean createConnectionFactory(String name, String clientID, int dupsOKBatchSize,
boolean strictTck,
int consumerWindowSize, int consumerMaxRate,
int producerWindowSize, int producerMaxRate,
List<String> jndiBindings) throws Exception;
+ /**
+ * destroys a connection factory.
+ * @param name the name of the connection factory to destroy
+ * @return true if the connection factory was destroyed
+ * @throws Exception if a problem occurred destroying the connection factory
+ */
boolean destroyConnectionFactory(String name) throws Exception;
+ /**
+ * list all messages for a specific queue
+ * @param queue the queue to inspect
+ * @return all messages
+ * @throws Exception if a problem occurred
+ */
public List<Message> listMessagesForQueue(String queue) throws Exception;
+ /**
+ * list the messages on a specific queue dependant on the ListType.
+ * ListType.ALL returns all messages
+ * ListType.DURABLE returns all durable messages
+ * ListType.NON_DURABLE returns all non durable messages
+ * @param queue the queue to inspect
+ * @param listType the list type.
+ * @return the messages
+ * @throws Exception if a problem occurred
+ */
public List<Message> listMessagesForQueue(String queue, ListType listType) throws Exception;
+ /**
+ * list all messages for a specific subscription
+ * @param subscription the subscription to inspect
+ * @return all messages
+ * @throws Exception if a problem occurred
+ */
public List<Message> listMessagesForSubscription(String subscription) throws Exception;
+ /**
+ * list the messages on a specific subscription dependant on the ListType.
+ * ListType.ALL returns all messages
+ * ListType.DURABLE returns all durable messages
+ * ListType.NON_DURABLE returns all non durable messages
+ * @param subscription the subscription to inspect
+ * @param listType the list type
+ * @return the messages
+ * @throws Exception if a problem occurred
+ */
public List<Message> listMessagesForSubscription(String subscription, ListType listType) throws Exception;
- void removeMessageFromQueue(String queueName, String messageId) throws Exception;
+ /**
+ * removes a particular message from a queue
+ * @param queue the name of the queue
+ * @param messageId the id of the message to remove
+ * @throws Exception if a problem occurred
+ */
+ void removeMessageFromQueue(String queue, String messageId) throws Exception;
- void removeMessageFromTopic(String topicName, String messageId) throws Exception;
+ /**
+ * removes a particular message from a topic
+ * @param topic the name of the topic
+ * @param messageId the id of the message
+ * @throws Exception if a problem occurred
+ */
+ void removeMessageFromTopic(String topic, String messageId) throws Exception;
- void removeAllMessagesForQueue(String queueName) throws Exception;
+ /**
+ * removes all messages from a particular queue
+ * @param queue the name of the queue
+ * @throws Exception if a problem occurred
+ */
+ void removeAllMessagesForQueue(String queue) throws Exception;
- void removeAllMessagesForTopic(String topicName) throws Exception;
+ /**
+ * removes all the messages from a topic
+ * @param topic the name of the topic
+ * @throws Exception if a problem occurred
+ */
+ void removeAllMessagesForTopic(String topic) throws Exception;
+ /**
+ * moves a message from one queue to another
+ * @param fromQueue the name of the queue to find the message
+ * @param toQueue the name of the queue to move the message to
+ * @param messageID the id of the message
+ * @throws Exception if a problem occurred
+ */
void moveMessage(String fromQueue, String toQueue, String messageID) throws Exception;
+ /**
+ * expires a message
+ * @param queue the name of the queue
+ * @param messageId the message id
+ * @throws Exception if a problem occurred
+ */
void expireMessage(String queue, String messageId) throws Exception;
+ /**
+ * changes the priority of a message.
+ * @param queue the name of the queue
+ * @param messageId the id of the message
+ * @param priority the priority to change the message to
+ * @throws Exception if a problem occurred
+ */
void changeMessagePriority(String queue, String messageId, int priority) throws Exception;
- void changeMessageHeader(String queue,String messageId, String header, Object value) throws Exception;
-
+ /**
+ * returns how many messages a queue is currently holding
+ * @param queue the name of the queue
+ * @return the number of messages
+ * @throws Exception if a problem occurred
+ */
int getMessageCountForQueue(String queue) throws Exception;
- List<SubscriptionInfo> listSubscriptions(String topicName) throws Exception;
+ /**
+ * lists all the subscriptions for a specific topic
+ * @param topic the name of the topic
+ * @return the subscriptions
+ * @throws Exception if a problem occurred
+ */
+ List<SubscriptionInfo> listSubscriptions(String topic) throws Exception;
+ /**
+ * lists all the subscriptions for a specific topic for a specific ListType.
+ * ListType.ALL returns all subscriptions
+ * ListType.DURABLE returns all durable subscriptions
+ * ListType.NON_DURABLE returns all non durable subscriptions
+ *
+ * @param topicName the name of the topic
+ * @param listType the list type
+ * @return the subscriptions
+ * @throws Exception if a problem occurred
+ */
List<SubscriptionInfo> listSubscriptions(String topicName, ListType listType) throws Exception;
- int getSubscriptionsCountForTopic(String topicName) throws Exception;
+ /**
+ * count the subscriptions a topic currently has
+ * @param topic the name of the topic
+ * @return the number of subscriptions
+ * @throws Exception if a problem occurred
+ */
+ int getSubscriptionsCountForTopic(String topic) throws Exception;
- int getSubscriptionsCountForTopic(String topicName, ListType listType) throws Exception;
+ /**
+ * count the subscriptions a topic currently has of a specific type.
+ * ListType.ALL returns all subscriptions
+ * ListType.DURABLE returns all durable subscriptions
+ * ListType.NON_DURABLE returns all non durable subscriptions
+ *
+ * @param topic the name of the topic
+ * @param listType the list type
+ * @return the number of subscriptions
+ * @throws Exception if a problem occurred
+ */
+ int getSubscriptionsCountForTopic(String topic, ListType listType) throws Exception;
+ /**
+ * drops a particular subscription
+ *
+ * @param subscription the id of the subscription
+ * @throws Exception if a problem occurred
+ */
void dropSubscription(String subscription) throws Exception;
+ /**
+ * count the consumers for a specific queue
+ * @param queue the name of the queue
+ * @return the number of consumers
+ * @throws Exception if a problem occurred
+ */
int getConsumerCountForQueue(String queue) throws Exception;
+ /**
+ * returns info on all the current active connections
+ * @return the connections info
+ * @throws Exception if a problem occurred
+ */
List<ConnectionInfo> getConnections() throws Exception;
+ /**
+ * return the connections info for a particular user.
+ * @param user the user
+ * @return the connections info
+ * @throws Exception if a problem occurred
+ */
List<ConnectionInfo> getConnectionsForUser(String user) throws Exception;
+ /**
+ * drops the connection with the specified client id
+ * @param clientId the client id
+ * @throws Exception if a problem occurred
+ */
void dropConnection(String clientId) throws Exception;
- void dropConnectionForUser(String user) throws Exception;
+ /**
+ * drop all the connections for a specific user
+ * @param user the user
+ * @throws Exception if a problem occurred
+ */
+ void dropConnectionsForUser(String user) throws Exception;
+ /**
+ * list all the sessions info
+ * @return the session info
+ * @throws Exception if a problem occurred
+ */
public List<SessionInfo> getSessions() throws Exception;
- public List<SessionInfo> getSessionsForConnection(String id) throws Exception;
+ /**
+ * get the session info for a particular connection with the specified client id
+ * @param clientid the client id
+ * @return the session info
+ * @throws Exception if a problem occurred
+ */
+ public List<SessionInfo> getSessionsForConnection(String clientid) throws Exception;
+ /**
+ * get the session info for a particular user
+ * @param user the user
+ * @return the session info
+ * @throws Exception if a problem occurred
+ */
public List<SessionInfo> getSessionsForUser(String user) throws Exception;
+ /**
+ * Start gathering delivery statistics for all queues
+ * @throws Exception if a problem occurred
+ */
void startGatheringStatistics() throws Exception;
+ /**
+ * Start gathering delivery statistics for a specified queue
+ * @param queue the name of the queue
+ * @throws Exception if a problem occurred
+ */
void startGatheringStatisticsForQueue(String queue) throws Exception;
+ /**
+ * stop gathering delivery statistics for all queues
+ * @return the delivery statistics at the time of stopping gathering
+ * @throws Exception if a problem occurred
+ */
List<MessageStatistics> stopGatheringStatistics() throws Exception;
+ /**
+ * stop gathering statistics for a specified queue
+ * @param queue the name of the queue
+ * @return the delivery statistics for that queue at the time of stopping gathering
+ * @throws Exception if a problem occurred
+ */
MessageStatistics stopGatheringStatisticsForQueue(String queue) throws Exception;
+ /**
+ * list all message delivery statistics. This will include statistics up to the point this method is called.
+ * The gathering of statistics will carry on.
+ * @return the delivery statistics
+ * @throws Exception if a problem occurred
+ */
List<MessageStatistics> getStatistics() throws Exception;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -370,12 +370,6 @@
"JMSMessageID='" + messageId + "'", priority);
}
- public void changeMessageHeader(String queue, String messageId, String header, Object value) throws Exception
- {
- messagingServerManagement.changeMessageHeader(new JBossQueue(queue).getAddress(),
- "JMSMessageID='" + messageId + "'", header, value);
- }
-
public int getMessageCountForQueue(String queue) throws Exception
{
return getMessageCount(new JBossQueue(queue));
@@ -447,7 +441,7 @@
}
}
- public void dropConnectionForUser(String user) throws Exception
+ public void dropConnectionsForUser(String user) throws Exception
{
List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
List<ConnectionInfo> connectionInfos = getConnectionsForUser(user);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/JMSServerManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/JMSServerManagerTest.java 2008-03-10 09:13:59 UTC (rev 3854)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/JMSServerManagerTest.java 2008-03-10 14:35:18 UTC (rev 3855)
@@ -21,9 +21,7 @@
*/
package org.jboss.test.messaging.jms.server;
-import org.apache.tools.ant.taskdefs.Sleep;
import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.ConnectionInfo;
import org.jboss.messaging.jms.server.JMSServerManager;
@@ -383,7 +381,7 @@
String id = conn4.getClientID();
try
{
- jmsServerManager.dropConnectionForUser("guest");
+ jmsServerManager.dropConnectionsForUser("guest");
List<ConnectionInfo> connectionInfos = jmsServerManager.getConnections();
assertNotNull(connectionInfos);
assertEquals(connectionInfos.size(), 3);
@@ -819,60 +817,6 @@
}
- public void testChangeMessageHeader() throws Exception
- {
- Connection conn = getConnectionFactory().createConnection("guest", "guest");
- try
- {
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = sess.createProducer(queue1);
-
- TextMessage message = sess.createTextMessage();
- message.setStringProperty("MyString", "12345");
- message.setBooleanProperty("MyBoolean", true);
- message.setByteProperty("MyByte", (byte) 1);
- message.setDoubleProperty("MyDouble", 0.0);
- message.setFloatProperty("MyFloat", 0.0f);
- message.setIntProperty("MyInt", 0);
- message.setObjectProperty("MyObject", new String("test"));
- message.setLongProperty("MyLong", 0l);
- message.setShortProperty("MyShort", (short)0);
-
- producer.send(message);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyString", "abcde");
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyBoolean", false);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyByte", (byte)2);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyDouble", 0.1);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyFloat", 0.1f);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyInt", 1);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyObject", new Long(0));
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyLong", 1l);
- jmsServerManager.changeMessageHeader("Queue1", message.getJMSMessageID(), "MyShort", (short)1);
- MessageConsumer consumer = sess.createConsumer(queue1);
- conn.start();
-
- message = (TextMessage) consumer.receive();
- assertEquals(message.getStringProperty("MyString"), "abcde");
- assertEquals(message.getBooleanProperty("MyBoolean"), false);
- assertEquals(message.getByteProperty("MyByte"), (byte)2);
- assertEquals(message.getDoubleProperty("MyDouble"), 0.1);
- assertEquals(message.getIntProperty("MyInt"), 1);
- assertEquals(message.getObjectProperty("MyObject").getClass(), Long.class);
- assertEquals(message.getLongProperty("MyLong"), 1l);
- assertEquals(message.getShortProperty("MyShort"), (short)1);
- consumer.close();
-
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
-
- }
-
public void testMessageStatistics() throws Exception
{
Connection conn = getConnectionFactory().createConnection("guest", "guest");
More information about the jboss-cvs-commits
mailing list