Use LogAccessor from SF

* Change main classes to use a `LogAccessor` API to simplify code flow
* Fix tests according `LogAccessor` property
* Fix some Sonar smells
This commit is contained in:
Artem Bilan
2020-10-06 13:56:50 -04:00
parent a66e82b0aa
commit c7ff99a4e8
95 changed files with 1165 additions and 1432 deletions

View File

@@ -150,7 +150,8 @@ public class ZeroMqChannel extends AbstractMessageChannel implements Subscribabl
setConnectUrl("tcp://localhost:" + this.zeroMqProxy.getFrontendPort() +
':' + this.zeroMqProxy.getBackendPort()))
.doOnError((error) ->
logger.error("The provided '" + this.zeroMqProxy + "' has not been started", error));
logger.error(error,
() -> "The provided '" + this.zeroMqProxy + "' has not been started"));
}
else {
return Mono.empty();
@@ -213,7 +214,8 @@ public class ZeroMqChannel extends AbstractMessageChannel implements Subscribabl
})
.publishOn(Schedulers.parallel())
.map(this.messageMapper::toMessage)
.doOnError((error) -> logger.error("Error processing ZeroMQ message in the " + this, error))
.doOnError((error) -> logger.error(error,
() -> "Error processing ZeroMQ message in the " + this))
.repeatWhenEmpty((repeat) ->
this.initialized
? repeat.delayElements(this.consumeDelay)

View File

@@ -270,7 +270,8 @@ public class ZeroMqMessageProducer extends MessageProducerSupport {
})
.publishOn(Schedulers.boundedElastic())
.transform((msgMono) -> this.receiveRaw ? mapRaw(msgMono) : convertMessage(msgMono))
.doOnError((error) -> logger.error("Error processing ZeroMQ message in the " + this, error))
.doOnError((error) ->
logger.error(error, () -> "Error processing ZeroMQ message in the " + this))
.repeatWhenEmpty((repeat) ->
this.active ? repeat.delayElements(this.consumeDelay) : repeat)
.repeat(() -> this.active)

View File

@@ -31,6 +31,7 @@ import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.integration.expression.ExpressionUtils;
import org.springframework.integration.expression.SupplierExpression;
import org.springframework.integration.handler.AbstractReactiveMessageHandler;
import org.springframework.integration.mapping.ConvertingBytesMessageMapper;
import org.springframework.integration.mapping.OutboundMessageMapper;
@@ -73,7 +74,7 @@ public class ZeroMqMessageHandler extends AbstractReactiveMessageHandler {
private Consumer<ZMQ.Socket> socketConfigurer = (socket) -> { };
private Expression topicExpression = new LiteralExpression(null);
private Expression topicExpression = new SupplierExpression<>(() -> null);
private EvaluationContext evaluationContext;