Skip to content

Commit

Permalink
INT-3881: MQTT: add XML recovery-intervalattr
Browse files Browse the repository at this point in the history
JIRA: https://jira.spring.io/browse/INT-3881

Also fix a couple typos in the WS xsd
  • Loading branch information
artembilan authored and garyrussell committed Jan 15, 2016
1 parent 84c5b7b commit b1a09f5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -28,6 +29,7 @@
* The MqttAdapter Message Driven Channel adapter parser
*
* @author Gary Russell
* @author Artem Bilan
* @since 4.0
*
*/
Expand All @@ -45,6 +47,7 @@ protected AbstractBeanDefinition doParse(Element element, ParserContext parserCo
builder.addPropertyReference("outputChannel", channelName);
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "qos");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "recovery-interval");

return builder.getBeanDefinition();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -36,6 +36,7 @@

/**
* @author Gary Russell
* @author Artem Bilan
* @since 4.0
*
*/
Expand Down Expand Up @@ -78,6 +79,7 @@ public void testNoTopics() { // INT-3467 no longer required to have topics
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion src/reference/asciidoc/mqtt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Attributes:
client-factory="clientFactory" <6>
send-timeout="123" <7>
error-channel="errors" <8>
recovery-interval="10000" <9>
channel="out" />
----

Expand Down Expand Up @@ -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.

Expand All @@ -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]
====
Expand Down

0 comments on commit b1a09f5

Please sign in to comment.