From e949a62f928b0dd9c45a89d297cb3c7a92572e07 Mon Sep 17 00:00:00 2001 From: Ruud Welling Date: Wed, 17 Jul 2019 17:14:36 +0200 Subject: [PATCH] Added withHeader(s) withProperty(-ies) and withoutDestination methods to the JmsMessage trait. --- .../mima-filters/1.1.0.backwards.excludes | 6 +++ .../akka/stream/alpakka/jms/JmsMessages.scala | 38 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 jms/src/main/mima-filters/1.1.0.backwards.excludes diff --git a/jms/src/main/mima-filters/1.1.0.backwards.excludes b/jms/src/main/mima-filters/1.1.0.backwards.excludes new file mode 100644 index 0000000000..9d91b9e8bb --- /dev/null +++ b/jms/src/main/mima-filters/1.1.0.backwards.excludes @@ -0,0 +1,6 @@ +# PR #1830 +ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.alpakka.jms.JmsMessage.withProperty") +ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.alpakka.jms.JmsMessage.withHeaders") +ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.alpakka.jms.JmsMessage.withProperties") +ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.alpakka.jms.JmsMessage.withHeader") +ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.alpakka.jms.JmsMessage.withoutDestination") diff --git a/jms/src/main/scala/akka/stream/alpakka/jms/JmsMessages.scala b/jms/src/main/scala/akka/stream/alpakka/jms/JmsMessages.scala index 39aeb7080d..8b9a3e6bee 100644 --- a/jms/src/main/scala/akka/stream/alpakka/jms/JmsMessages.scala +++ b/jms/src/main/scala/akka/stream/alpakka/jms/JmsMessages.scala @@ -73,7 +73,18 @@ object JmsPassThrough { /** * Marker trait for stream elements that do not contain pass-through data. */ -sealed trait JmsMessage extends JmsEnvelope[NotUsed] +sealed trait JmsMessage extends JmsEnvelope[NotUsed] { + + def withHeader(jmsHeader: JmsHeader): JmsMessage + + def withHeaders(newHeaders: Set[JmsHeader]): JmsMessage + + def withProperty(name: String, value: Any): JmsMessage + + def withProperties(props: Map[String, Any]): JmsMessage + + def withoutDestination: JmsMessage +} object JmsMessage { @@ -197,12 +208,17 @@ final class JmsByteMessage private (bytes: Array[Byte], */ override def withHeader(jmsHeader: JmsHeader): JmsByteMessage = copy(headers = headers + jmsHeader) + override def withHeaders(newHeaders: Set[JmsHeader]): JmsByteMessage = copy(headers = headers ++ newHeaders) + /** * Add a property */ override def withProperty(name: String, value: Any): JmsByteMessage = copy(properties = properties + (name -> value)) + override def withProperties(props: Map[String, Any]): JmsByteMessage = + copy(properties = properties ++ props) + override def toQueue(name: String): JmsByteMessage = to(Queue(name)) override def toTopic(name: String): JmsByteMessage = to(Topic(name)) @@ -355,12 +371,17 @@ final class JmsByteStringMessage private (bytes: ByteString, */ override def withHeader(jmsHeader: JmsHeader): JmsByteStringMessage = copy(headers = headers + jmsHeader) + override def withHeaders(newHeaders: Set[JmsHeader]): JmsByteStringMessage = copy(headers = headers ++ newHeaders) + /** * Add a property */ override def withProperty(name: String, value: Any): JmsByteStringMessage = copy(properties = properties + (name -> value)) + override def withProperties(props: Map[String, Any]): JmsByteStringMessage = + copy(properties = properties ++ props) + override def toQueue(name: String): JmsByteStringMessage = to(Queue(name)) override def toTopic(name: String): JmsByteStringMessage = to(Topic(name)) @@ -517,12 +538,17 @@ final class JmsMapMessage(body: Map[String, Any], */ override def withHeader(jmsHeader: JmsHeader): JmsMapMessage = copy(headers = headers + jmsHeader) + override def withHeaders(newHeaders: Set[JmsHeader]): JmsMapMessage = copy(headers = headers ++ newHeaders) + /** * Add a property */ override def withProperty(name: String, value: Any): JmsMapMessage = copy(properties = properties + (name -> value)) + override def withProperties(props: Map[String, Any]): JmsMapMessage = + copy(properties = properties ++ props) + override def toQueue(name: String): JmsMapMessage = to(Queue(name)) override def toTopic(name: String): JmsMapMessage = to(Topic(name)) @@ -675,11 +701,16 @@ final class JmsTextMessage private (body: String, */ override def withHeader(jmsHeader: JmsHeader): JmsTextMessage = copy(headers = headers + jmsHeader) + override def withHeaders(newHeaders: Set[JmsHeader]): JmsTextMessage = copy(headers = headers ++ newHeaders) + /** * Add a property */ override def withProperty(name: String, value: Any): JmsTextMessage = copy(properties = properties + (name -> value)) + override def withProperties(props: Map[String, Any]): JmsTextMessage = + copy(properties = properties ++ props) + override def toQueue(name: String): JmsTextMessage = to(Queue(name)) override def toTopic(name: String): JmsTextMessage = to(Topic(name)) @@ -830,12 +861,17 @@ final class JmsObjectMessage private (serializable: java.io.Serializable, */ override def withHeader(jmsHeader: JmsHeader): JmsObjectMessage = copy(headers = headers + jmsHeader) + override def withHeaders(newHeaders: Set[JmsHeader]): JmsObjectMessage = copy(headers = headers ++ newHeaders) + /** * Add a property */ override def withProperty(name: String, value: Any): JmsObjectMessage = copy(properties = properties + (name -> value)) + override def withProperties(props: Map[String, Any]): JmsObjectMessage = + copy(properties = properties ++ props) + override def toQueue(name: String): JmsObjectMessage = to(Queue(name)) override def toTopic(name: String): JmsObjectMessage = to(Topic(name))