Skip to content

Commit 77936b9

Browse files
committed
Add zeromq.adoc to index files
* Fix Sonar smells for new ZeroMQ components * Upgrade to Spring Data `2020.0.0-M2`
1 parent 269e984 commit 77936b9

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ext {
9999
smackVersion = '4.3.4'
100100
soapVersion = '1.4.0'
101101
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.3.0-SNAPSHOT'
102-
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2020.0.0-SNAPSHOT'
102+
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2020.0.0-M2'
103103
springKafkaVersion = '2.6.0-SNAPSHOT'
104104
springRetryVersion = '1.3.0'
105105
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.4.0-RC1'

spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/ZeroMqProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public synchronized void start() {
290290
this.running.set(true);
291291
ZMQ.proxy(frontendSocket, backendSocket, captureSocket, controlSocket);
292292
}
293-
catch (Exception ex) {
293+
catch (Exception ex) { // NOSONAR
294294
LOG.error("Cannot start ZeroMQ proxy from bean: " + this.beanName, ex);
295295
}
296296
finally {

spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/channel/ZeroMqChannel.java

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -123,29 +123,10 @@ public ZeroMqChannel(ZContext context, boolean pubSub) {
123123

124124
Supplier<String> localPairConnection = () -> "inproc://" + getComponentName() + ".pair";
125125

126-
Mono<?> proxyMono =
127-
Mono.defer(() -> {
128-
if (this.zeroMqProxy != null) {
129-
return Mono.fromCallable(() -> this.zeroMqProxy.getBackendPort())
130-
.filter((port) -> port > 0)
131-
.repeatWhenEmpty(100, // NOSONAR
132-
(repeat) -> repeat.delayElements(Duration.ofMillis(100))) // NOSONAR
133-
.doOnNext((port) ->
134-
setConnectUrl("tcp://localhost:" + this.zeroMqProxy.getFrontendPort() +
135-
':' + this.zeroMqProxy.getBackendPort()))
136-
.doOnError((error) ->
137-
logger.error("The provided '"
138-
+ this.zeroMqProxy + "' has not been started", error));
139-
}
140-
else {
141-
return Mono.empty();
142-
}
143-
})
144-
.cache();
126+
Mono<?> proxyMono = proxyMono();
145127

146128
this.sendSocket =
147-
proxyMono
148-
.publishOn(this.publisherScheduler)
129+
proxyMono.publishOn(this.publisherScheduler)
149130
.then(Mono.fromCallable(() ->
150131
this.context.createSocket(
151132
this.connectSendUrl == null
@@ -165,8 +146,7 @@ public ZeroMqChannel(ZContext context, boolean pubSub) {
165146
.publishOn(this.publisherScheduler);
166147

167148
this.subscribeSocket =
168-
proxyMono
169-
.publishOn(this.subscriberScheduler)
149+
proxyMono.publishOn(this.subscriberScheduler)
170150
.then(Mono.fromCallable(() ->
171151
this.context.createSocket(
172152
this.connectSubscribeUrl == null
@@ -208,14 +188,32 @@ public ZeroMqChannel(ZContext context, boolean pubSub) {
208188
.repeat(() -> this.initialized);
209189

210190
if (this.pubSub) {
211-
receiveData = receiveData.publish()
212-
.autoConnect(1, (disposable) -> this.subscriberDataDisposable = disposable);
191+
receiveData =
192+
receiveData.publish()
193+
.autoConnect(1, (disposable) -> this.subscriberDataDisposable = disposable);
213194
}
214195

215196
this.subscriberData = receiveData;
216197

217198
}
218199

200+
private Mono<Integer> proxyMono() {
201+
if (this.zeroMqProxy != null) {
202+
return Mono.fromCallable(() -> this.zeroMqProxy.getBackendPort())
203+
.filter((proxyPort) -> proxyPort > 0)
204+
.repeatWhenEmpty(100, (repeat) -> repeat.delayElements(Duration.ofMillis(100))) // NOSONAR
205+
.doOnNext((proxyPort) ->
206+
setConnectUrl("tcp://localhost:" + this.zeroMqProxy.getFrontendPort() +
207+
':' + this.zeroMqProxy.getBackendPort()))
208+
.doOnError((error) ->
209+
logger.error("The provided '" + this.zeroMqProxy + "' has not been started", error))
210+
.cache();
211+
}
212+
else {
213+
return Mono.empty();
214+
}
215+
}
216+
219217
/**
220218
* Configure a connection to the ZeroMQ proxy with the pair of ports over colon
221219
* for proxy frontend and backend sockets. Mutually exclusive with the {@link #setZeroMqProxy(ZeroMqProxy)}.
@@ -226,7 +224,7 @@ public void setConnectUrl(@Nullable String connectUrl) {
226224
if (connectUrl != null) {
227225
this.connectSendUrl = connectUrl.substring(0, connectUrl.lastIndexOf(':'));
228226
this.connectSubscribeUrl =
229-
this.connectSendUrl.substring(0, this.connectSendUrl.lastIndexOf(':'))
227+
this.connectSendUrl.substring(0, this.connectSendUrl.lastIndexOf(':')) // NOSONAR
230228
+ connectUrl.substring(connectUrl.lastIndexOf(':'));
231229
}
232230
}
@@ -314,7 +312,7 @@ public void destroy() {
314312
this.subscribeSocket.doOnNext(ZMQ.Socket::close).block();
315313
this.subscriberScheduler.dispose();
316314
if (this.subscriberDataDisposable != null) {
317-
this.subscriberDataDisposable.dispose();
315+
this.subscriberDataDisposable.dispose(); // NOSONAR
318316
}
319317
}
320318

src/reference/asciidoc/index-single.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ include::./xml.adoc[]
8787

8888
include::./xmpp.adoc[]
8989

90+
include::./zeromq.adoc[]
91+
9092
include::./zookeeper.adoc[]
9193

9294
[[spring-integration-appendices]]

src/reference/asciidoc/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ This documentation is also available as single searchable link:index-single.html
5353
<<./ws.adoc#ws,Web Services Support>> ::
5454
<<./xml.adoc#xml,XML Support - Dealing with XML Payloads>> ::
5555
<<./xmpp.adoc#xmpp,XMPP Support>> ::
56+
<<./zeromq.adoc#zeromq,ZeroMQ Support>> ::
5657
<<./zookeeper.adoc#zookeeper,Zookeeper Support>> ::
5758

5859
[horizontal]

0 commit comments

Comments
 (0)