pjfanning commented on code in PR #1526:
URL: https://github.com/apache/pekko-connectors/pull/1526#discussion_r2993796573
##########
couchbase3/src/main/scala/org/apache/pekko/stream/connectors/couchbase3/javadsl/CouchbaseSink.scala:
##########
@@ -24,69 +24,189 @@ import org.apache.pekko.Done
import org.apache.pekko.stream.connectors.couchbase3.scaladsl.{ CouchbaseSink
=> ScalaCouchbaseSink }
import org.apache.pekko.stream.javadsl.Sink
+import java.util.concurrent.CompletionStage
import scala.concurrent.Future
+import scala.jdk.FutureConverters._
object CouchbaseSink {
/**
* reference to [[CouchbaseFlow.insertDoc]]
+ * <p>
+ * This function's return type changed in 2.0.0 to return a Sink with a
CompletionStage instead of a
+ * Scala Future, to be more consistent with Java usage.
+ * </p>
+ * @see {@link #insertDocFuture} which works like this method worked in 1.x.
*/
def insertDoc[T](insertOptions: InsertOptions)(
+ implicit asyncCollection: AsyncCollection): Sink[MutationDocument[T],
CompletionStage[Done]] =
+
ScalaCouchbaseSink.insertDoc[T](insertOptions).mapMaterializedValue(_.asJava).asJava
+
+ /**
+ * reference to [[CouchbaseFlow.insertDoc]]
+ * @deprecated Use insertDoc which returns CompletionStage instead
+ */
+ @deprecated("Use insertDoc which returns CompletionStage instead", since =
"2.0.0")
+ def insertDocFuture[T](insertOptions: InsertOptions)(
implicit asyncCollection: AsyncCollection): Sink[MutationDocument[T],
Future[Done]] =
ScalaCouchbaseSink.insertDoc[T](insertOptions).asJava
/**
- * reference to [[CouchbaseFlow.upsertDoc]]
+ * reference to [[CouchbaseFlow.insert]]
+ * <p>
+ * This function's return type changed in 2.0.0 to return a Sink with a
CompletionStage instead of a
+ * Scala Future, to be more consistent with Java usage.
+ * </p>
+ * @see {@link #insertFuture} which works like this method worked in 1.x.
*/
def insert[T](applyId: T => String,
+ insertOptions: InsertOptions)(
+ implicit asyncCollection: AsyncCollection): Sink[T,
CompletionStage[Done]] =
+ ScalaCouchbaseSink.insert[T](applyId,
insertOptions).mapMaterializedValue(_.asJava).asJava
+
+ /**
+ * reference to [[CouchbaseFlow.insert]]
+ * @deprecated Use insert which returns CompletionStage instead
+ */
+ @deprecated("Use insert which returns CompletionStage instead", since =
"2.0.0")
+ def insertFuture[T](applyId: T => String,
insertOptions: InsertOptions)(
implicit asyncCollection: AsyncCollection): Sink[T, Future[Done]] =
ScalaCouchbaseSink.insert[T](applyId, insertOptions).asJava
/**
* reference to [[CouchbaseFlow.upsertDoc]]
+ * <p>
+ * This function's return type changed in 2.0.0 to return a Sink with a
CompletionStage instead of a
+ * Scala Future, to be more consistent with Java usage.
+ * </p>
+ * @see {@link #upsertDocFuture} which works like this method worked in 1.x.
*/
def upsertDoc[T](upsertOptions: UpsertOptions =
UpsertOptions.upsertOptions())(
+ implicit asyncCollection: AsyncCollection): Sink[MutationDocument[T],
CompletionStage[Done]] =
+
ScalaCouchbaseSink.upsertDoc[T](upsertOptions).mapMaterializedValue(_.asJava).asJava
+
+ /**
+ * reference to [[CouchbaseFlow.upsertDoc]]
+ * @deprecated Use upsertDoc which returns CompletionStage instead
+ */
+ @deprecated("Use upsertDoc which returns CompletionStage instead", since =
"2.0.0")
+ def upsertDocFuture[T](upsertOptions: UpsertOptions =
UpsertOptions.upsertOptions())(
implicit asyncCollection: AsyncCollection): Sink[MutationDocument[T],
Future[Done]] =
ScalaCouchbaseSink.upsertDoc[T](upsertOptions).asJava
/**
* reference to [[CouchbaseFlow.upsert]]
+ * <p>
+ * This function's return type changed in 2.0.0 to return a Sink with a
CompletionStage instead of a
+ * Scala Future, to be more consistent with Java usage.
+ * </p>
+ * @see {@link #upsertFuture} which works like this method worked in 1.x.
*/
def upsert[T](applyId: T => String,
Review Comment:
addressed this in #1528
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]