akka.stream.alpakka.amqp.scaladsl.AmqpFlowWithContext.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of akka-stream-alpakka-amqp_2.13 Show documentation
Show all versions of akka-stream-alpakka-amqp_2.13 Show documentation
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
/*
* Copyright (C) since 2016 Lightbend Inc.
*/
package akka.stream.alpakka.amqp.scaladsl
import akka.Done
import akka.stream.alpakka.amqp._
import akka.stream.scaladsl.{Flow, FlowWithContext}
import scala.concurrent.Future
object AmqpFlowWithContext {
/**
* Creates a contextual variant of corresponding [[AmqpFlow]].
*
* @see [[AmqpFlow.apply]]
*/
def apply[T](
settings: AmqpWriteSettings
): FlowWithContext[WriteMessage, T, WriteResult, T, Future[Done]] =
FlowWithContext.fromTuples(
Flow.fromGraph(new impl.AmqpSimpleFlowStage[T](settings))
)
/**
* Creates a contextual variant of corresponding [[AmqpFlow]].
*
* @see [[AmqpFlow.withConfirm]]
*
* NOTE: This connector uses RabbitMQ's extension to AMQP protocol
* ([[https://www.rabbitmq.com/confirms.html#publisher-confirms Publisher Confirms]]), therefore it is not
* supposed to be used with another AMQP brokers.
*/
def withConfirm[T](
settings: AmqpWriteSettings
): FlowWithContext[WriteMessage, T, WriteResult, T, Future[Done]] =
FlowWithContext.fromTuples(
Flow.fromGraph(new impl.AmqpAsyncFlowStage(settings))
)
}