akkadotnet / Alpakka

Akka Streams Connectors - Alpakka

Home Page:https://alpakka.getakka.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It's impossible to send durable messages with AMQP Sink

vasily-kirichenko opened this issue · comments

To make messages persistent it's necessary to do two things: make the queue durable and set DeliveryMode = 2 for each message. The former is simple:

let queueDeclaration = QueueDeclaration.Create(queueName).WithDurable(true)`

But the latter is impossible with the current implementation:

    Source
        .From(seq { 1..1_000 })
        .Select(fun x -> x |> string |> ByteString.FromString) // no way to set basic properties
        .To(sink)
        .Run(mat)
    |> ignore

Sample is here https://github.com/vasily-kirichenko/AmqpStreams/blob/master/AmqpStreams1/Program.fs

you have to use AmqpSink.create(...) and then set for example:
new OutgoingMessage(elem,false,false,
Optional.of(new AMQP.BasicProperties.Builder()
.deliveryMode(2).build()),
Optional.empty()))

this will create persistent message in rabbit

Yes, thanks.