git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1179470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-10-05 23:17:22 +00:00
parent f793fbd7e6
commit 6faa9c3546
1 changed files with 32 additions and 30 deletions

View File

@ -17,7 +17,6 @@
package org.apache.activemq.broker.util;
import java.io.IOException;
import java.util.Map;
import org.apache.activemq.broker.BrokerPluginSupport;
import org.apache.activemq.command.MessageDispatch;
@ -32,9 +31,8 @@ import org.slf4j.LoggerFactory;
*
* @org.apache.xbean.XBean element="traceBrokerPathPlugin"
*
*
*/
@SuppressWarnings("unchecked")
public class TraceBrokerPathPlugin extends BrokerPluginSupport {
private String stampProperty = "BrokerPath";
@ -45,11 +43,14 @@ public class TraceBrokerPathPlugin extends BrokerPluginSupport {
}
public void setStampProperty(String stampProperty) {
if (stampProperty != null && !stampProperty.isEmpty()) {
this.stampProperty = stampProperty;
}
}
public void preProcessDispatch(MessageDispatch messageDispatch) {
try {
if (messageDispatch != null && messageDispatch.getMessage() != null) {
String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
if (brokerStamp == null) {
brokerStamp = getBrokerName();
@ -57,6 +58,7 @@ public class TraceBrokerPathPlugin extends BrokerPluginSupport {
brokerStamp += "," + getBrokerName();
}
messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
}
} catch (IOException ioe) {
LOG.warn("Setting broker property failed " + ioe, ioe);
}