camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SenthilKumar K <senthilec...@gmail.com>
Subject Re: Streaming Cassandra Table ( Polling every 5s - Near Realtime )
Date Wed, 26 Jul 2017 11:17:52 GMT
Adding Dev Group ...


--Senthil

On Wed, Jul 26, 2017 at 3:14 PM, SenthilKumar K <senthilec566@gmail.com>
wrote:

> Hello Camel Users ,  Recently i started exploring possibilities of
> streaming data from Cassandra Table for my use case, found *https://github.com/apache/camel/tree/master/components/camel-cassandraql
> <https://github.com/apache/camel/tree/master/components/camel-cassandraql>*
> . This seems to be good candidate for my use case!
>
>
> Use Case :
> ProcessA  --Write---> Cassandra <---READ--- ProcessB ---> Analytics System
>
> ProcessA is responsible to write data continuously to apache cassandra and
> in near realtime another process read/parse and send it to downstream
> system.
>
> Consumer :
> https://github.com/oscerd/camel-cassandra/blob/master/
> src/main/java/com/github/oscerd/component/cassandra/CassandraConsumer.java
>
> I want to start the Consumer Process which should run 24/7 and start
> processing unless until it gets Kill Request..
>
> Here is the Code i tried:
> public class CassandraConsumer   {
> public static void main(String[] args) throws Exception {
>     CassandraEndpoint endpoint = new CassandraEndpoint();
>     endpoint.setPort("9042");
>     endpoint.setKeyspace("test");
>     endpoint.setHost("127.0.0.1");
>     endpoint.setTable("stream_data");
>     endpoint.setPollingQuery("select * from stream_data");
>     Processor p = new Processor() {
> public void process(Exchange exchange) throws Exception {
> ResultSet body = (ResultSet) exchange.getIn().getBody();
> List<Row> allRows = body.all();
> for(Row r : allRows ){
> System.out.println(r.getInt("id")+"  "+r.getString("data"));
> }
> }
> };
> endpoint.createConsumer(p).start();
> }
> }
>
> This is not working ( I dont know how to use Consumer ).
>
> Questions :
>      1)  Can this Cassandra Camel Consumer opt for my Use Case ?
>       2) If Yes ( for above Q) , How to use Cassandra Consumer ?  It would
> be great if i get sample code !
>
>
> --Senthil
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message