From b1a09f5b0dc46e38ec5850888db90fc8ce7e9652 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 14 Jan 2016 13:36:35 -0500 Subject: [PATCH] INT-3881: MQTT: add XML `recovery-interval`attr JIRA: https://jira.spring.io/browse/INT-3881 Also fix a couple typos in the WS xsd --- .../xml/MqttMessageDrivenChannelAdapterParser.java | 5 ++++- .../mqtt/config/spring-integration-mqtt-4.3.xsd | 9 +++++++++ ...qttMessageDrivenChannelAdapterParserTests-context.xml | 1 + .../xml/MqttMessageDrivenChannelAdapterParserTests.java | 4 +++- .../integration/ws/config/spring-integration-ws-4.3.xsd | 4 ++-- src/reference/asciidoc/mqtt.adoc | 6 +++++- 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParser.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParser.java index 994168610e..0d51ece5f9 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParser.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParser.java @@ -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(); } diff --git a/spring-integration-mqtt/src/main/resources/org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd b/spring-integration-mqtt/src/main/resources/org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd index d147efd192..997f2ac855 100644 --- a/spring-integration-mqtt/src/main/resources/org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd +++ b/spring-integration-mqtt/src/main/resources/org/springframework/integration/mqtt/config/spring-integration-mqtt-4.3.xsd @@ -65,6 +65,15 @@ + + + + + + diff --git a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParserTests-context.xml b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParserTests-context.xml index 48553f1538..8056903147 100644 --- a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParserTests-context.xml +++ b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttMessageDrivenChannelAdapterParserTests-context.xml @@ -15,6 +15,7 @@ client-id="foo" url="tcp://localhost:1883" client-factory="clientFactory" + recovery-interval="5000" channel="out" /> - 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. diff --git a/src/reference/asciidoc/mqtt.adoc b/src/reference/asciidoc/mqtt.adoc index ab0e44e26a..ec87df5e7e 100644 --- a/src/reference/asciidoc/mqtt.adoc +++ b/src/reference/asciidoc/mqtt.adoc @@ -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] ====