Selector header name is exposed for configuration

Issue: SPR-16732
This commit is contained in:
Rossen Stoyanchev
2018-04-16 23:56:30 -04:00
parent 586be50109
commit ff2228fdaf
8 changed files with 150 additions and 34 deletions

View File

@@ -383,6 +383,10 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
String heartbeatValue = simpleBrokerElem.getAttribute("heartbeat");
brokerDef.getPropertyValues().add("heartbeatValue", heartbeatValue);
}
if (simpleBrokerElem.hasAttribute("selector-header")) {
String headerName = simpleBrokerElem.getAttribute("selector-header");
brokerDef.getPropertyValues().add("selectorHeaderName", headerName);
}
}
else if (brokerRelayElem != null) {
String prefix = brokerRelayElem.getAttribute("prefix");

View File

@@ -384,6 +384,23 @@
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="selector-header" type="xsd:string">
<xsd:annotation>
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.SimpleBrokerMessageHandler"><![CDATA[
Configure the name of a header that a subscription message can have for
the purpose of filtering messages matched to the subscription. The header
value is expected to be a Spring EL boolean expression to be applied to
the headers of messages matched to the subscription.
For example:
headers.foo == 'bar'
By default this is set to "selector". You can set it to a different
name, or to "" to turn off support for a selector header.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="channel">