INT-1568 removed the MessageHeaders.PREFIX constant since it's no longer necessary. Also added @ManagedOperation to the IntegrationMBeanExporter's getChannelSendRate(..) method.
This commit is contained in:
@@ -57,33 +57,31 @@ public final class MessageHeaders implements Map<String, Object>, Serializable {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(MessageHeaders.class);
|
||||
|
||||
public static final String PREFIX = "";
|
||||
|
||||
/**
|
||||
* The key for the Message ID. This is an automatically generated UUID and
|
||||
* should never be explicitly set in the header map <b>except</b> in the
|
||||
* case of Message deserialization where the serialized Message's generated
|
||||
* UUID is being restored.
|
||||
*/
|
||||
public static final String ID = PREFIX + "id";
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String TIMESTAMP = PREFIX + "timestamp";
|
||||
public static final String TIMESTAMP = "timestamp";
|
||||
|
||||
public static final String CORRELATION_ID = PREFIX + "correlationId";
|
||||
public static final String CORRELATION_ID = "correlationId";
|
||||
|
||||
public static final String REPLY_CHANNEL = PREFIX + "replyChannel";
|
||||
public static final String REPLY_CHANNEL = "replyChannel";
|
||||
|
||||
public static final String ERROR_CHANNEL = PREFIX + "errorChannel";
|
||||
public static final String ERROR_CHANNEL = "errorChannel";
|
||||
|
||||
public static final String EXPIRATION_DATE = PREFIX + "expirationDate";
|
||||
public static final String EXPIRATION_DATE = "expirationDate";
|
||||
|
||||
public static final String PRIORITY = PREFIX + "priority";
|
||||
public static final String PRIORITY = "priority";
|
||||
|
||||
public static final String SEQUENCE_NUMBER = PREFIX + "sequenceNumber";
|
||||
public static final String SEQUENCE_NUMBER = "sequenceNumber";
|
||||
|
||||
public static final String SEQUENCE_SIZE = PREFIX + "sequenceSize";
|
||||
public static final String SEQUENCE_SIZE = "sequenceSize";
|
||||
|
||||
public static final String SEQUENCE_DETAILS = PREFIX + "sequenceDetails";
|
||||
public static final String SEQUENCE_DETAILS = "sequenceDetails";
|
||||
|
||||
|
||||
private final Map<String, Object> headers;
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.ListIterator;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.context.NamedComponent;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -39,7 +38,7 @@ import org.springframework.util.StringUtils;
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageHistory implements List<Properties>, Serializable {
|
||||
|
||||
public static final String HEADER_NAME = MessageHeaders.PREFIX + "history";
|
||||
public static final String HEADER_NAME = "history";
|
||||
|
||||
public static final String NAME_PROPERTY = "name";
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
import org.springframework.integration.annotation.Headers;
|
||||
import org.springframework.integration.gateway.GatewayMethodInboundMessageMapper;
|
||||
@@ -200,7 +199,7 @@ public class GatewayMethodInboundMessageMapperToMessageTests {
|
||||
Map<String, Expression> headers = new HashMap<String, Expression>();
|
||||
headers.put("foo", new LiteralExpression("foo"));
|
||||
headers.put("bar", new SpelExpressionParser().parseExpression("6 * 7"));
|
||||
headers.put(MessageHeaders.PREFIX + "baz", new LiteralExpression("hello"));
|
||||
headers.put("baz", new LiteralExpression("hello"));
|
||||
GatewayMethodInboundMessageMapper mapper = new GatewayMethodInboundMessageMapper(method, headers);
|
||||
Message<?> message = mapper.toMessage(new Object[] { "test" });
|
||||
assertEquals("test", message.getPayload());
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -59,7 +58,7 @@ public class HeaderEnrichedGatewayTests {
|
||||
assertEquals(testPayload, message1.getPayload());
|
||||
assertEquals("foo", message1.getHeaders().get("foo"));
|
||||
assertEquals("bar", message1.getHeaders().get("bar"));
|
||||
assertNull(message1.getHeaders().get(MessageHeaders.PREFIX + "baz"));
|
||||
assertNull(message1.getHeaders().get("baz"));
|
||||
|
||||
testPayload = 123;
|
||||
gatewayWithHeaderValues.sendInteger((Integer) testPayload);
|
||||
@@ -67,7 +66,7 @@ public class HeaderEnrichedGatewayTests {
|
||||
assertEquals(testPayload, message2.getPayload());
|
||||
assertEquals("foo", message2.getHeaders().get("foo"));
|
||||
assertEquals("bar", message2.getHeaders().get("bar"));
|
||||
assertNull(message2.getHeaders().get(MessageHeaders.PREFIX + "baz"));
|
||||
assertNull(message2.getHeaders().get("baz"));
|
||||
|
||||
testPayload = "withAnnotatedHeaders";
|
||||
gatewayWithHeaderValues.sendStringWithParameterHeaders((String) testPayload, "headerA", "headerB");
|
||||
@@ -86,7 +85,7 @@ public class HeaderEnrichedGatewayTests {
|
||||
assertEquals(testPayload, message1.getPayload());
|
||||
assertEquals(42, message1.getHeaders().get("foo"));
|
||||
assertEquals("foobar", message1.getHeaders().get("bar"));
|
||||
assertNull(message1.getHeaders().get(MessageHeaders.PREFIX + "baz"));
|
||||
assertNull(message1.getHeaders().get("baz"));
|
||||
|
||||
testPayload = 123;
|
||||
gatewayWithHeaderExpressions.sendInteger((Integer) testPayload);
|
||||
@@ -94,7 +93,7 @@ public class HeaderEnrichedGatewayTests {
|
||||
assertEquals(testPayload, message2.getPayload());
|
||||
assertEquals(42, message2.getHeaders().get("foo"));
|
||||
assertEquals("foobar", message2.getHeaders().get("bar"));
|
||||
assertNull(message2.getHeaders().get(MessageHeaders.PREFIX + "baz"));
|
||||
assertNull(message2.getHeaders().get("baz"));
|
||||
|
||||
testPayload = "withAnnotatedHeaders";
|
||||
gatewayWithHeaderExpressions.sendStringWithParameterHeaders((String) testPayload, "headerA", "headerB");
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.file;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Pre-defined header names to be used when storing or retrieving
|
||||
* File-related values to/from integration Message Headers.
|
||||
@@ -26,7 +24,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public abstract class FileHeaders {
|
||||
|
||||
private static final String PREFIX = MessageHeaders.PREFIX + "file_";
|
||||
private static final String PREFIX = "file_";
|
||||
|
||||
public static final String FILENAME = PREFIX + "name";
|
||||
|
||||
|
||||
@@ -16,15 +16,13 @@
|
||||
|
||||
package org.springframework.integration.http;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @since 1.0.2
|
||||
*/
|
||||
public abstract class HttpHeaders {
|
||||
|
||||
private static final String PREFIX = MessageHeaders.PREFIX + "http_";
|
||||
private static final String PREFIX = "http_";
|
||||
|
||||
public static final String REQUEST_URL = PREFIX + "requestUrl";
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.ip;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Headers for Messages mapped from IP datagram packets.
|
||||
*
|
||||
@@ -28,9 +26,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public abstract class IpHeaders {
|
||||
|
||||
private static final String PREFIX = MessageHeaders.PREFIX;
|
||||
|
||||
private static final String IP = PREFIX + "ip_";
|
||||
private static final String IP = "ip_";
|
||||
|
||||
private static final String TCP = IP + "tcp_";
|
||||
|
||||
|
||||
@@ -18,11 +18,8 @@ package org.springframework.integration.ip.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@@ -37,16 +34,4 @@ public class RegexUtilsTests {
|
||||
assertEquals("xxx\\$\\^\\[\\]\\{\\(\\)\\}\\+\\*\\\\\\?\\|\\.xxx", RegexUtils.escapeRegexSpecials(s));
|
||||
}
|
||||
|
||||
/**
|
||||
* And one of the ones we are actually using
|
||||
*/
|
||||
@Test
|
||||
@Ignore // no longer relevant due to INT-1568
|
||||
public void testSiPrefix () {
|
||||
// protect the test in case we ever change the prefix
|
||||
if ("$^[]{()}+*\\?|.".contains(MessageHeaders.PREFIX)) {
|
||||
assertEquals(RegexUtils.escapeRegexSpecials(MessageHeaders.PREFIX), "\\" + MessageHeaders.PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jms;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Pre-defined names and prefixes to be used for setting and/or retrieving JMS
|
||||
* attributes from/to integration Message Headers.
|
||||
@@ -31,7 +29,7 @@ public abstract class JmsHeaders {
|
||||
* user-defined headers and other internal headers (e.g. correlationId).
|
||||
* @see DefaultJmsHeaderMapper
|
||||
*/
|
||||
public static final String PREFIX = MessageHeaders.PREFIX + "jms_";
|
||||
public static final String PREFIX = "jms_";
|
||||
|
||||
public static final String MESSAGE_ID = PREFIX + "messageId";
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jmx;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Constants for JMX related Message Header keys.
|
||||
*
|
||||
@@ -26,7 +24,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public abstract class JmxHeaders {
|
||||
|
||||
public static final String PREFIX = MessageHeaders.PREFIX + "jmx_";
|
||||
public static final String PREFIX = "jmx_";
|
||||
|
||||
public static final String OBJECT_NAME = PREFIX + "objectName";
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.springframework.jmx.export.MBeanExporter;
|
||||
import org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.jmx.export.annotation.ManagedMetric;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler;
|
||||
import org.springframework.jmx.export.naming.MetadataNamingStrategy;
|
||||
@@ -356,6 +357,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements BeanPostP
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public Statistics getChannelSendRate(String name) {
|
||||
if (channelsByName.containsKey(name)) {
|
||||
return channelsByName.get(name).getSendRate();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.mail;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Pre-defined header names to be used for setting and/or retrieving Mail
|
||||
* Message attributes from/to integration Message Headers.
|
||||
@@ -26,7 +24,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public abstract class MailHeaders {
|
||||
|
||||
public static final String PREFIX = MessageHeaders.PREFIX + "mail_";
|
||||
public static final String PREFIX = "mail_";
|
||||
|
||||
public static final String SUBJECT = PREFIX + "subject";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.ws;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
|
||||
/**
|
||||
* Pre-defined header names to be used when storing or retrieving
|
||||
* Web Service properties to/from integration Message Headers.
|
||||
@@ -26,7 +24,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public abstract class WebServiceHeaders {
|
||||
|
||||
public static final String PREFIX = MessageHeaders.PREFIX + "ws_";
|
||||
public static final String PREFIX = "ws_";
|
||||
|
||||
public static final String SOAP_ACTION = PREFIX + "soapAction";
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.integration.xmpp;
|
||||
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
/**
|
||||
* Used as keys for {@link org.springframework.integration.Message} objects
|
||||
* that handle XMPP events.
|
||||
@@ -28,7 +27,7 @@ import org.springframework.integration.MessageHeaders;
|
||||
*/
|
||||
public class XmppHeaders {
|
||||
|
||||
private static final String PREFIX = MessageHeaders.PREFIX + "xmpp_";
|
||||
private static final String PREFIX = "xmpp_";
|
||||
|
||||
public static final String CHAT = PREFIX + "chatKey";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user