How can I make a callback after each message is successfully sent to JMS or fails?
val jmsSink = JmsSink.textSink(
JmsSinkSettings(connectionFactory).withQueue("My_Queue")
)
Source(Stream.from(1))
.map(_.toString)
.runWith(jmsSink)
More Specific example
// creating a sourceQueue which is bound to jmsSink
val sourceQueue: SourceQueueWithComplete[String] =
Source.queue[String](bufferSize, OverflowStrategy.backpressure)
.to(jmsSink)
.run()
The client is sending item to sourceQueue
:
val result: Future[QueueOfferResult] = sourceQueue offer "my-item"
val result
is the result of inserting the item into sourceQueue
, it doesn't mean that it is sent to JMS yet. I need to trigger an event when the item has gone through the sink process, and inserted to JMS queue.