diff --git a/activemq-core/src/main/java/org/activemq/broker/AbstractConnection.java b/activemq-core/src/main/java/org/activemq/broker/AbstractConnection.java
index deb097dffa..0baab2b0a1 100755
--- a/activemq-core/src/main/java/org/activemq/broker/AbstractConnection.java
+++ b/activemq-core/src/main/java/org/activemq/broker/AbstractConnection.java
@@ -115,6 +115,13 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
taskRunner = null;
}
+ /**
+ * Returns the number of messages to be dispatched to this connection
+ */
+ public int getDispatchQueueSize() {
+ return dispatchQueue.size();
+ }
+
public void start() throws Exception {
this.dispatch(connector.getBrokerInfo());
}
diff --git a/activemq-core/src/main/java/org/activemq/broker/Connection.java b/activemq-core/src/main/java/org/activemq/broker/Connection.java
index c8a7329681..c6e33d7066 100755
--- a/activemq-core/src/main/java/org/activemq/broker/Connection.java
+++ b/activemq-core/src/main/java/org/activemq/broker/Connection.java
@@ -1,21 +1,21 @@
/**
-* ActiveMQ: The Open Source Message Fabric
-*
-* Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-**/
+ * ActiveMQ: The Open Source Message Fabric
+ *
+ * Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ **/
package org.activemq.broker;
import org.activemq.Service;
@@ -36,10 +36,11 @@ public interface Connection extends Service {
/**
* Sends a message to the client.
*
- * @param message the message to send to the client.
+ * @param message
+ * the message to send to the client.
*/
public void dispatchSync(Command message);
-
+
/**
* Sends a message to the client.
*
@@ -47,39 +48,42 @@ public interface Connection extends Service {
*/
public void dispatchAsync(Command command);
-
/**
- * Services a client command and submits it to the broker.
+ * Services a client command and submits it to the broker.
+ *
* @param command
*/
public Response service(Command command);
-
+
/**
* Handles an unexpected error associated with a connection.
*
* @param error
*/
public void serviceException(Throwable error);
-
+
/**
* @return true if the Connection is slow
*/
public boolean isSlow();
-
+
/**
* @return if after being marked, the Connection is still writing
*/
public boolean isBlocked();
-
-
+
/**
* @return true if the Connection is connected
*/
public boolean isConnected();
-
+
/**
* @return true if the Connection is active
*/
public boolean isActive();
+ /**
+ * Returns the number of messages to be dispatched to this connection
+ */
+ public int getDispatchQueueSize();
}
diff --git a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionView.java b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionView.java
index 0958bd9bec..e65cbfc601 100755
--- a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionView.java
+++ b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionView.java
@@ -66,4 +66,10 @@ public class ConnectionView implements ConnectionViewMBean {
}
+ /**
+ * Returns the number of messages to be dispatched to this connection
+ */
+ public int getDispatchQueueSize() {
+ return connection.getDispatchQueueSize();
+ }
}
diff --git a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionViewMBean.java b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionViewMBean.java
index 12d3043e70..b05114b4e2 100755
--- a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionViewMBean.java
+++ b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectionViewMBean.java
@@ -25,21 +25,24 @@ public interface ConnectionViewMBean extends Service {
* @return true if the Connection is slow
*/
public boolean isSlow();
-
+
/**
* @return if after being marked, the Connection is still writing
*/
public boolean isBlocked();
-
-
+
/**
* @return true if the Connection is connected
*/
public boolean isConnected();
-
+
/**
* @return true if the Connection is active
*/
public boolean isActive();
-
+
+ /**
+ * Returns the number of messages to be dispatched to this connection
+ */
+ public int getDispatchQueueSize();
}
\ No newline at end of file
diff --git a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorView.java b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorView.java
index 87851d0364..1bc41d6b2f 100755
--- a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorView.java
+++ b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorView.java
@@ -20,6 +20,7 @@ package org.activemq.broker.jmx;
import org.activemq.broker.Connector;
import org.activemq.command.BrokerInfo;
+import org.activemq.command.RedeliveryPolicy;
public class ConnectorView implements ConnectorViewMBean {
@@ -33,12 +34,61 @@ public class ConnectorView implements ConnectorViewMBean {
connector.start();
}
+ public String getBrokerName() {
+ return getBrokerInfo().getBrokerName();
+ }
+
public void stop() throws Exception {
connector.stop();
}
-
+
+ public String getBrokerURL() {
+ return getBrokerInfo().getBrokerURL();
+ }
+
public BrokerInfo getBrokerInfo() {
return connector.getBrokerInfo();
}
+ public short getBackOffMultiplier() {
+ return getRedeliveryPolicy().getBackOffMultiplier();
+ }
+
+ public long getInitialRedeliveryDelay() {
+ return getRedeliveryPolicy().getInitialRedeliveryDelay();
+ }
+
+ public int getMaximumRedeliveries() {
+ return getRedeliveryPolicy().getMaximumRedeliveries();
+ }
+
+ public boolean isUseExponentialBackOff() {
+ return getRedeliveryPolicy().isUseExponentialBackOff();
+ }
+
+ public void setBackOffMultiplier(short backOffMultiplier) {
+ getRedeliveryPolicy().setBackOffMultiplier(backOffMultiplier);
+ }
+
+ public void setInitialRedeliveryDelay(long initialRedeliveryDelay) {
+ getRedeliveryPolicy().setInitialRedeliveryDelay(initialRedeliveryDelay);
+ }
+
+ public void setMaximumRedeliveries(int maximumRedeliveries) {
+ getRedeliveryPolicy().setMaximumRedeliveries(maximumRedeliveries);
+ }
+
+ public void setUseExponentialBackOff(boolean useExponentialBackOff) {
+ getRedeliveryPolicy().setUseExponentialBackOff(useExponentialBackOff);
+ }
+
+ public RedeliveryPolicy getRedeliveryPolicy() {
+ RedeliveryPolicy redeliveryPolicy = getBrokerInfo().getRedeliveryPolicy();
+ if (redeliveryPolicy == null) {
+ redeliveryPolicy = new RedeliveryPolicy();
+ getBrokerInfo().setRedeliveryPolicy(redeliveryPolicy);
+ }
+ return redeliveryPolicy;
+ }
+
}
diff --git a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorViewMBean.java b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorViewMBean.java
index 1b59d4674d..4ebd22a5d2 100755
--- a/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorViewMBean.java
+++ b/activemq-core/src/main/java/org/activemq/broker/jmx/ConnectorViewMBean.java
@@ -20,9 +20,24 @@ package org.activemq.broker.jmx;
import org.activemq.Service;
import org.activemq.command.BrokerInfo;
+import org.activemq.command.RedeliveryPolicy;
public interface ConnectorViewMBean extends Service {
- public BrokerInfo getBrokerInfo();
+ public short getBackOffMultiplier();
+
+ public long getInitialRedeliveryDelay();
+
+ public int getMaximumRedeliveries();
+
+ public boolean isUseExponentialBackOff();
+
+ public void setBackOffMultiplier(short backOffMultiplier);
+
+ public void setInitialRedeliveryDelay(long initialRedeliveryDelay);
+
+ public void setMaximumRedeliveries(int maximumRedeliveries);
+
+ public void setUseExponentialBackOff(boolean useExponentialBackOff);
}
\ No newline at end of file