You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by prashant amar <am...@gmail.com> on 2013/07/16 18:21:24 UTC

Sample Kafka Producer/Consumer example in Scala

Hello All

I have been attempting to build an end-to-end example of producer with
multiple consumers using scala.
I managed to build a producer, but when I attempt to build a consumer the
following statement causes the scala REPL to block/hang

val consumerMap = consumer.createMessageStreams(topicCountMap)

Am I missing anything here?

Can anybody please point me to a simple producer with multiple consumers
example in scala?

*Please do not point me to ConsumerConsumer or MirrorMaker as both of them
are fairly complex to even look at (given that I am a novice scala
programmer)*

Any help will be appreciated?

Thanks in advance
Amar

Re: Sample Kafka Producer/Consumer example in Scala

Posted by Jun Rao <ju...@gmail.com>.
What you did is correct. Could you try running it as a standalone app and
not from scala REPL?

Thanks,

Jun


On Tue, Jul 16, 2013 at 9:21 AM, prashant amar <am...@gmail.com> wrote:

> Hello All
>
> I have been attempting to build an end-to-end example of producer with
> multiple consumers using scala.
> I managed to build a producer, but when I attempt to build a consumer the
> following statement causes the scala REPL to block/hang
>
> val consumerMap = consumer.createMessageStreams(topicCountMap)
>
> Am I missing anything here?
>
> Can anybody please point me to a simple producer with multiple consumers
> example in scala?
>
> *Please do not point me to ConsumerConsumer or MirrorMaker as both of them
> are fairly complex to even look at (given that I am a novice scala
> programmer)*
>
> Any help will be appreciated?
>
> Thanks in advance
> Amar
>