INT-3881: MQTT: add XML recovery-intervalattr
JIRA: https://jira.spring.io/browse/INT-3881 Also fix a couple typos in the WS xsd
This commit is contained in:
committed by
Gary Russell
parent
84c5b7b193
commit
b1a09f5b0d
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.mqtt.config.xml;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
@@ -28,6 +29,7 @@ import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannel
|
||||
* The MqttAdapter Message Driven Channel adapter parser
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
@@ -45,6 +47,7 @@ public class MqttMessageDrivenChannelAdapterParser extends AbstractChannelAdapte
|
||||
builder.addPropertyReference("outputChannel", channelName);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "qos");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "recovery-interval");
|
||||
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
@@ -65,6 +65,15 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="recovery-interval" type="xsd:string" default="10000">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The time in milliseconds to wait between reconnection attempts.
|
||||
Defaults to 10 seconds.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="error-channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
client-id="foo"
|
||||
url="tcp://localhost:1883"
|
||||
client-factory="clientFactory"
|
||||
recovery-interval="5000"
|
||||
channel="out" />
|
||||
|
||||
<int-mqtt:message-driven-channel-adapter id="noTopicsAdapterDefaultCF"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
@@ -78,6 +79,7 @@ public class MqttMessageDrivenChannelAdapterParserTests {
|
||||
assertEquals(0, TestUtils.getPropertyValue(noTopicsAdapter, "topics", Collection.class).size());
|
||||
assertSame(out, TestUtils.getPropertyValue(noTopicsAdapter, "outputChannel"));
|
||||
assertSame(clientFactory, TestUtils.getPropertyValue(noTopicsAdapter, "clientFactory"));
|
||||
assertEquals(5000, TestUtils.getPropertyValue(this.noTopicsAdapter, "recoveryInterval"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The Destination URI for this Web Service Gateway. If the URI should be determined at runtime
|
||||
(e.g. registry lookup), then configure a 'destination-provider' reference instead. Aternatively,
|
||||
(e.g. registry lookup), then configure a 'destination-provider' reference instead. Alternatively,
|
||||
this URI may include {placeholders} whose values are determined by evaluating SpEL expressions
|
||||
provided via 'uri-variable' sub-elements. The root object for those evaluations is the actual
|
||||
request Message at runtime, i.e. you can access its payload or headers in the expression.
|
||||
@@ -136,7 +136,7 @@
|
||||
<xsd:attribute name="marshaller" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Reference to a Spring OXM Mashaller. If the Marshaller instance also implements
|
||||
Reference to a Spring OXM Marshaller. If the Marshaller instance also implements
|
||||
the Unmarshaller interface, then the 'unmarshaller' attribute is not required.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
|
||||
@@ -46,6 +46,7 @@ Attributes:
|
||||
client-factory="clientFactory" <6>
|
||||
send-timeout="123" <7>
|
||||
error-channel="errors" <8>
|
||||
recovery-interval="10000" <9>
|
||||
channel="out" />
|
||||
----
|
||||
|
||||
@@ -77,6 +78,9 @@ The `DefaultPahoMessageConverter` can be configured to return the raw `byte[]` i
|
||||
|
||||
<8> The error channel - downstream exceptions will be sent to this channel, if supplied, in an `ErrorMessage`; the payload is a `MessagingException` containing the failed message and cause.
|
||||
|
||||
<9> The recovery interval - controls the interval at which the adapter will attempt to reconnect after
|
||||
a failure; it defaults to `10000ms` (ten seconds).
|
||||
|
||||
NOTE: Starting with _version 4.1_ the url can be omitted and, instead, the server URIs can be provided in the `serverURIs` property of the `DefaultMqttPahoClientFactory`.
|
||||
This enables, for example, connection to a highly available (HA) cluster.
|
||||
|
||||
@@ -87,7 +91,7 @@ These events can be received by a bean that implements `ApplicationListener`.
|
||||
|
||||
Also, a new property `recoveryInterval` controls the interval at which the adapter will attempt to reconnect after
|
||||
a failure; it defaults to `10000ms` (ten seconds).
|
||||
This is not currently available using XML configuration.
|
||||
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user