Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B533C9D3E for ; Thu, 16 May 2013 23:03:42 +0000 (UTC) Received: (qmail 65276 invoked by uid 500); 16 May 2013 23:03:43 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 65248 invoked by uid 500); 16 May 2013 23:03:43 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 65239 invoked by uid 99); 16 May 2013 23:03:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 May 2013 23:03:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 May 2013 23:03:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6703C238889B; Thu, 16 May 2013 23:03:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130516230318.6703C238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 JMS_PROPERTY_SETERS = new HashMap(); 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);