[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: JMX Operations to expose to clients in JBM 2.0
ataylor
do-not-reply at jboss.com
Wed Nov 7 04:32:58 EST 2007
Actually I've had a rethink. Moving all the methods form topic/queuembean into ServerPeer makes it a bit monolithic. I think creating and exposing a new interface say 'JmsServerStatistics' for these methods would be a bit more elegant.
something like
| public interface JmsServerStatistics
| {
|
|
| int getMessageCountForQueue(String queue) throws Exception;
|
| int getDeliveringCountForQueue(String queue) throws Exception;
|
| int getScheduledMessageCountForQueue(String queue) throws Exception;
|
| MessageCounter getMessageCounterForQueue(String queue);
|
| MessageStatistics getMessageStatisticsForQueue(String queue) throws Exception;
|
| int getConsumerCountForQueue(String queue) throws Exception;
|
| void resetMessageCounterForQueue(String queue);
|
| void resetMessageCounterHistoryForQueue(String queue);
|
| List listAllMessagesForQueue(String queue) throws Exception;
|
| List listAllMessagesForQueue(String queue,String selector) throws Exception;
|
| List listDurableMessagesForQueue(String queue) throws Exception;
|
| List listDurableMessagesForQueue(String queue,String selector) throws Exception;
|
| List listNonDurableMessagesForQueue(String queue) throws Exception;
|
| List listNonDurableMessagesForQueue(String queue,String selector) throws Exception;
|
| String listMessageCounterAsHTMLForQueue(String queue);
|
| String listMessageCounterHistoryAsHTMLForQueue(String queue);
|
| //topic
|
| int getAllMessageCountForTopic() throws Exception;
|
| int getDurableMessageCountForTopic() throws Exception;
|
| int getNonDurableMessageCountForTopic() throws Exception;
|
| int getAllSubscriptionsCountForTopic() throws Exception;
|
| int getDurableSubscriptionsCountForTopic() throws Exception;
|
| int getNonDurableSubscriptionsCountForTopic() throws Exception;
|
| // JMX operations
|
| void removeAllMessagesForTopic(String topic) throws Exception;
|
| List listAllSubscriptionsForTopic(String topic) throws Exception;
|
| List listDurableSubscriptionsForTopic(String topic) throws Exception;
|
| List listNonDurableSubscriptionsForTopic(String topic) throws Exception;
|
| String listAllSubscriptionsAsHTMLForTopic(String topic) throws Exception;
|
| String listDurableSubscriptionsAsHTMLForTopic(String topic) throws Exception;
|
| String listNonDurableSubscriptionsAsHTMLForTopic(String topic) throws Exception;
|
| List listAllMessagesForTopic(String topic,String subscriptionId) throws Exception;
|
| List listAllMessagesForTopic(String topic,String subscriptionId, String selector) throws Exception;
|
| List listDurableMessagesForTopic(String topic,String subscriptionId) throws Exception;
|
| List listDurableMessagesForTopic(String topic,String subscriptionId, String selector) throws Exception;
|
| List listNonDurableMessagesForTopic(String topic,String subscriptionId) throws Exception;
|
| List listNonDurableMessagesForTopic(String topic,String subscriptionId, String selector) throws Exception;
|
| List getMessageCountersForTopic(String topic) throws Exception;
| }
|
Also with very little work we could expose these to the user via an abstraction so they dont have to worry about JMX etc.
something like
|
| public void connect(InitialContext initialContext)
| {
| connect(initialContext, null, null);
| }
|
| public void connect(InitialContext initialContext, String user, String password)
| {
| this.initialContext = initialContext;
| this.user = user;
| this.password = password;
| }
|
| public JmsServer getServer()
| {
| return (JmsServer) Proxy.newProxyInstance(JmsServer.class.getClassLoader(),
| new Class[] { JmsServer.class },
| new JmsServerInvocationHandler(initialContext));
|
| }
|
| public JmsServerStatistics getServerStatistics()
| {
| return (JmsServerStatistics) Proxy.newProxyInstance(JmsServerStatistics.class.getClassLoader(),
| new Class[] { JmsServerStatistics.class },
| new JmsServerStatisticsInvocationHandler());
| }
|
| public static void main(String[] args) throws Exception
| {
| Admin admin = new Admin();
| Hashtable env = new Hashtable();
| env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| env.put("java.naming.provider.url", "jnp://localhost:1099");
| env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
|
| InitialContext ic = new InitialContext(env);
| admin.connect(ic);
| JmsServer server = admin.getServer();
| server.getJMSMajorVersion();
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102439#4102439
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102439
More information about the jboss-dev-forums
mailing list