From f9450413658d77782127f850709fb00483fb55e1 Mon Sep 17 00:00:00 2001 From: Enno <458526+ennru@users.noreply.github.com> Date: Tue, 6 Aug 2019 09:39:46 +0200 Subject: [PATCH] Rename setting --- jms/src/main/resources/reference.conf | 2 +- .../alpakka/jms/JmsConsumerSettings.scala | 18 +++++++++--------- .../alpakka/jms/impl/JmsTxSourceStage.scala | 2 +- .../docs/scaladsl/JmsTxConnectorsSpec.scala | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/jms/src/main/resources/reference.conf b/jms/src/main/resources/reference.conf index 9d30608edd..cbeadf31cd 100644 --- a/jms/src/main/resources/reference.conf +++ b/jms/src/main/resources/reference.conf @@ -52,7 +52,7 @@ alpakka.jms { ack-timeout = 1 second # For use with transactions, if true the stream fails if Alpakka rolls back the transaction # when `ack-timeout` is hit. - fail-on-ack-timeout = false + fail-stream-on-ack-timeout = false } #consumer diff --git a/jms/src/main/scala/akka/stream/alpakka/jms/JmsConsumerSettings.scala b/jms/src/main/scala/akka/stream/alpakka/jms/JmsConsumerSettings.scala index 62821a3c96..1ef5d07e4e 100644 --- a/jms/src/main/scala/akka/stream/alpakka/jms/JmsConsumerSettings.scala +++ b/jms/src/main/scala/akka/stream/alpakka/jms/JmsConsumerSettings.scala @@ -21,7 +21,7 @@ final class JmsConsumerSettings private ( val selector: Option[String], val acknowledgeMode: Option[AcknowledgeMode], val ackTimeout: scala.concurrent.duration.Duration, - val failOnAckTimeout: Boolean + val failStreamOnAckTimeout: Boolean ) extends akka.stream.alpakka.jms.JmsSettings { /** Factory to use for creating JMS connections. */ @@ -76,8 +76,8 @@ final class JmsConsumerSettings private ( /** * For use with transactions, if true the stream fails if Alpakka rolls back the transaction when `ackTimeout` is hit. */ - def withFailOnAckTimeout(value: Boolean): JmsConsumerSettings = - if (failOnAckTimeout == value) this else copy(failOnAckTimeout = value) + def withFailStreamOnAckTimeout(value: Boolean): JmsConsumerSettings = + if (failStreamOnAckTimeout == value) this else copy(failStreamOnAckTimeout = value) private def copy( connectionFactory: javax.jms.ConnectionFactory = connectionFactory, @@ -89,7 +89,7 @@ final class JmsConsumerSettings private ( selector: Option[String] = selector, acknowledgeMode: Option[AcknowledgeMode] = acknowledgeMode, ackTimeout: scala.concurrent.duration.Duration = ackTimeout, - failOnAckTimeout: Boolean = failOnAckTimeout + failStreamOnAckTimeout: Boolean = failStreamOnAckTimeout ): JmsConsumerSettings = new JmsConsumerSettings( connectionFactory = connectionFactory, connectionRetrySettings = connectionRetrySettings, @@ -100,7 +100,7 @@ final class JmsConsumerSettings private ( selector = selector, acknowledgeMode = acknowledgeMode, ackTimeout = ackTimeout, - failOnAckTimeout = failOnAckTimeout + failStreamOnAckTimeout = failStreamOnAckTimeout ) override def toString = @@ -114,8 +114,8 @@ final class JmsConsumerSettings private ( s"selector=$selector," + s"acknowledgeMode=${acknowledgeMode.map(m => AcknowledgeMode.asString(m))}," + s"ackTimeout=${ackTimeout.toCoarsest}," + - s"failOnAckTimeout=$failOnAckTimeout" - ")" + s"failStreamOnAckTimeout=$failStreamOnAckTimeout" + + ")" } object JmsConsumerSettings { @@ -145,7 +145,7 @@ object JmsConsumerSettings { val acknowledgeMode = getOption("acknowledge-mode", c => AcknowledgeMode.from(c.getString("acknowledge-mode"))) val ackTimeout = c.getDuration("ack-timeout").asScala - val failOnAckTimeout = c.getBoolean("fail-on-ack-timeout") + val failStreamOnAckTimeout = c.getBoolean("fail-stream-on-ack-timeout") new JmsConsumerSettings( connectionFactory, connectionRetrySettings, @@ -156,7 +156,7 @@ object JmsConsumerSettings { selector, acknowledgeMode, ackTimeout, - failOnAckTimeout + failStreamOnAckTimeout ) } diff --git a/jms/src/main/scala/akka/stream/alpakka/jms/impl/JmsTxSourceStage.scala b/jms/src/main/scala/akka/stream/alpakka/jms/impl/JmsTxSourceStage.scala index 916baa5947..7987ac9fbd 100644 --- a/jms/src/main/scala/akka/stream/alpakka/jms/impl/JmsTxSourceStage.scala +++ b/jms/src/main/scala/akka/stream/alpakka/jms/impl/JmsTxSourceStage.scala @@ -60,7 +60,7 @@ private[jms] final class JmsTxSourceStage(settings: JmsConsumerSettings, destina case _: TimeoutException => val exception = new JmsTxAckTimeout(settings.ackTimeout) session.session.rollback() - if (settings.failOnAckTimeout) { + if (settings.failStreamOnAckTimeout) { handleError.invoke(exception) } else { log.warning(exception.getMessage) diff --git a/jms/src/test/scala/docs/scaladsl/JmsTxConnectorsSpec.scala b/jms/src/test/scala/docs/scaladsl/JmsTxConnectorsSpec.scala index b225ed5aa5..07147c56bf 100644 --- a/jms/src/test/scala/docs/scaladsl/JmsTxConnectorsSpec.scala +++ b/jms/src/test/scala/docs/scaladsl/JmsTxConnectorsSpec.scala @@ -572,7 +572,7 @@ class JmsTxConnectorsSpec extends JmsSpec { resultList.toSet should contain theSameElementsAs numsIn.map(_.toString) } - "fail the stream when ack-timeout causes a rollback (and fail-on-ack-timeout is true)" in { + "fail the stream when ack-timeout causes a rollback (and fail-stream-on-ack-timeout is true)" in { withConnectionFactory() { connectionFactory => val jmsSink: Sink[JmsTextMessage, Future[Done]] = JmsProducer.sink( JmsProducerSettings(producerConfig, connectionFactory).withQueue("numbers") @@ -591,7 +591,7 @@ class JmsTxConnectorsSpec extends JmsSpec { .withSessionCount(5) .withQueue("numbers") .withAckTimeout(10.millis) - .withFailOnAckTimeout(true) + .withFailStreamOnAckTimeout(true) ) val r = new java.util.Random