0

据我所知,ActiveMQPERSISTENT默认将交付模式设置为......那么NON_PERSISTENT在使用 Akka-Camel 时如何为特定主题设置交付模式?下面是我的示例代码:

import akka.actor._
import akka.camel._
import org.apache.activemq.camel.component.ActiveMQComponent

case class MyMessage(body: String)

class MyProducer() extends Actor with Producer with Oneway {
  def endpointUri: String = "activemq:MyTopic"
}

class SimpleConsumer() extends Actor with Consumer {
  def endpointUri: String = "activemq:MyTopic"

  def receive = {
    case msg: CamelMessage => println(msg)
  }
}

object MyApp extends App {

  val actorSystem = ActorSystem("MyApp")
  val system = CamelExtension(actorSystem)

  system.context.addComponent(
     "activemq",
     ActiveMQComponent.activeMQComponent("nio://localhost:61616")
  )

  val consumer = actorSystem.actorOf(Props[MyConsumer])
  val producer = actorSystem.actorOf(Props[MyProducer])

  ...

  producer ! MyMessage("hello")

  ...

  actorSystem.shutdown()
}
4

1 回答 1

1

这些选项在端点 URI 上设置。

"activemq:MyTopic?deliveryPersistent=false"
于 2015-09-26T15:07:37.903 回答