You can look at the consumer example at http://kafka.apache.org/documentation.html#highlevelconsumerapi
Thanks, Jun On Wed, Oct 8, 2014 at 7:51 PM, Sa Li <sal...@gmail.com> wrote: > Hi, All > > I setup a kafka cluster, and plan to publish the messages from Web to > kafka, the messages are in the form of json, I want to implement a consumer > to write the message I consumer to postgresql DB, not aggregation at all. I > was thinking to use KafkaSpout in storm to make it happen, now I want to > simplify the step, just use kafka consumer to populate message into > postgresql. This consumer should have the functions of consumer data, write > into postgresql DB in batch, if servers down, consumer can retrieve the > data it stored in hard drive with no redundancy and can consume the data > from where it stopped once the server up. > > Is there any sample code for this? > > > thanks a lot > > > Alec