I'm using a producer in an actor and wondering about the thread safety
of Producer (and Sync/Async Producer). Pseudo-code is something like:
class OurProducer(properties:Properties) extends Actor {
val config = new ProducerConfig(properties)
val producer = new Producer[Long, String](config)
def act() = {
loop {
react {
case msg:QueueMessage => producer.send(new ProducerData[Long,
String](queueName, id, Array(msg.toString))
case _ => println("Unsupported message type")
}
}
}
}
The service that uses this class instantiates just one instance, and
repeatedly sends QueueMessage's to it. There is a single Producer
instance available for use.
So, are there any potential concerns either with Producer.send or the
producer itself, being used in this way?
Thanks in advance,
-Blake
--
Blake Matheny