activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1483600 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ activemq-client/src/main/java/org/apache/activemq/command/ activemq-client/src/main/java/org/apache/activemq/filter/ activemq-unit-tests/src/test/j...
Date Thu, 16 May 2013 23:03:18 GMT
Author: gtully
Date: Thu May 16 23:03:17 2013
New Revision: 1483600

URL: http://svn.apache.org/r1483600
Log:
https://issues.apache.org/jira/browse/AMQ-4539 - add JMSActiveMQBrokerPath string property
and brokerPath attribute via jmx message view, the list length is the current number of network
hops

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java
    activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java?rev=1483600&r1=1483599&r2=1483600&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
Thu May 16 23:03:17 2013
@@ -24,6 +24,7 @@ public interface CompositeDataConstants 
     String PROPERTIES = "PropertiesText";
     String JMSXGROUP_SEQ = "JMSXGroupSeq";
     String JMSXGROUP_ID = "JMSXGroupID";
+    String BROKER_PATH = "BrokerPath";
     String BODY_LENGTH = "BodyLength";
     String BODY_PREVIEW = "BodyPreview";
     String CONTENT_MAP = "ContentMap";

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java?rev=1483600&r1=1483599&r2=1483600&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java
Thu May 16 23:03:17 2013
@@ -40,6 +40,7 @@ import javax.management.openmbean.Tabula
 import javax.management.openmbean.TabularType;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -129,6 +130,7 @@ public final class OpenTypeSupport {
             addItem("JMSTimestamp", "JMSTimestamp", SimpleType.DATE);
             addItem(CompositeDataConstants.JMSXGROUP_ID, "Message Group ID", SimpleType.STRING);
             addItem(CompositeDataConstants.JMSXGROUP_SEQ, "Message Group Sequence Number",
SimpleType.INTEGER);
+            addItem(CompositeDataConstants.BROKER_PATH, "Brokers traversed", SimpleType.STRING);
             addItem(CompositeDataConstants.ORIGINAL_DESTINATION, "Original Destination Before
Senting To DLQ", SimpleType.STRING);
             addItem(CompositeDataConstants.PROPERTIES, "User Properties Text", SimpleType.STRING);
 
@@ -168,6 +170,7 @@ public final class OpenTypeSupport {
             rc.put("JMSTimestamp", new Date(m.getJMSTimestamp()));
             rc.put(CompositeDataConstants.JMSXGROUP_ID, m.getGroupID());
             rc.put(CompositeDataConstants.JMSXGROUP_SEQ, m.getGroupSequence());
+            rc.put(CompositeDataConstants.BROKER_PATH, Arrays.toString(m.getBrokerPath()));
             rc.put(CompositeDataConstants.ORIGINAL_DESTINATION, toString(m.getOriginalDestination()));
             try {
                 rc.put(CompositeDataConstants.PROPERTIES, "" + m.getProperties());

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java?rev=1483600&r1=1483599&r2=1483600&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
Thu May 16 23:03:17 2013
@@ -46,6 +46,8 @@ import org.apache.activemq.util.TypeConv
 public class ActiveMQMessage extends Message implements org.apache.activemq.Message, ScheduledMessage
{
     public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_MESSAGE;
     public static final String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = "dlqDeliveryFailureCause";
+    public static final String BROKER_PATH_PROPERTY = "JMSActiveMQBrokerPath";
+
     private static final Map<String, PropertySetter> JMS_PROPERTY_SETERS = new HashMap<String,
PropertySetter>();
 
     protected transient Callback acknowledgeCallback;

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java?rev=1483600&r1=1483599&r2=1483600&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java
Thu May 16 23:03:17 2013
@@ -18,6 +18,7 @@
 package org.apache.activemq.filter;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -159,6 +160,12 @@ public class PropertyExpression implemen
                 return Long.valueOf(message.getBrokerOutTime());
             }
         });
+        JMS_PROPERTY_EXPRESSIONS.put("JMSActiveMQBrokerPath", new SubExpression() {
+
+            public Object evaluate(Message message) {
+                return Arrays.toString(message.getBrokerPath());
+            }
+        });
     }
 
     private final String name;

Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java?rev=1483600&r1=1483599&r2=1483600&view=diff
==============================================================================
--- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java
(original)
+++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java
Thu May 16 23:03:17 2013
@@ -41,6 +41,7 @@ import javax.jms.QueueBrowser;
 import javax.jms.Session;
 import javax.management.ObjectName;
 
+import javax.management.openmbean.CompositeData;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.BrokerTestSupport;
@@ -51,6 +52,7 @@ import org.apache.activemq.broker.jmx.Qu
 import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.command.ActiveMQDestination;
+import org.apache.activemq.command.ActiveMQMessage;
 import org.apache.activemq.command.ActiveMQTextMessage;
 import org.apache.activemq.command.ConnectionId;
 import org.apache.activemq.command.ConnectionInfo;
@@ -223,6 +225,8 @@ public class BrokerNetworkWithStuckMessa
             assertNotNull(message1);
             LOG.info("on remote, got: " + message1.getMessageId());
             connection2.send(createAck(consumerInfo2, message1, 1, MessageAck.INDIVIDUAL_ACK_TYPE));
+            assertTrue("JMSActiveMQBrokerPath property present and correct",
+                    ((ActiveMQMessage)message1).getStringProperty(ActiveMQMessage.BROKER_PATH_PROPERTY).contains(localBroker.getBroker().getBrokerId().toString()));
         }
 
         // Ensure that there are zero messages on the local broker. This tells
@@ -273,7 +277,10 @@ public class BrokerNetworkWithStuckMessa
         messages = browseQueueWithJmx(remoteBroker);
         assertEquals(5, messages.length);
 
-         LOG.info("Messages now stuck on remote");
+        assertTrue("can see broker path property",
+                ((String)((CompositeData)messages[1]).get("BrokerPath")).contains(localBroker.getBroker().getBrokerId().toString()));
+
+        LOG.info("Messages now stuck on remote");
 
         // receive again on the origin broker
         ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destinationInfo1);



Mime
View raw message