Evan M.
Evan M.

Reputation: 433

Explicit ack to JMS using Alpakka

I am currently using Akka-Camel for integrating my Akka based application with various message queues.
Now that I want to upgrade to the latest version of Akka I see that this integration is now deprecated.

I have tried using alpakka-jsm integration but am unable to see whether I can perform explicit ack to the message queues once I have processed the message. Does this functionality exist in this new component?

Upvotes: 1

Views: 232

Answers (1)

Jeffrey Chung
Jeffrey Chung

Reputation: 19527

Alpakka 0.15 makes the acknowledgement mode in the JMS connector configurable. An example that's adapted from the linked documentation:

val jmsSource: Source[Message, NotUsed] = JmsSource(
  JmsSourceSettings(connectionFactory)
    .withQueue("myqueue")
    .withAcknowledgeMode(AcknowledgeMode.ClientAcknowledge)
)

val result = jmsSource
  .map {
    case textMessage: TextMessage =>
      val text = textMessage.getText
      textMessage.acknowledge()
      text
  }
  .runWith(Sink.seq)

Upvotes: 1

Related Questions