Github user fhussonnois commented on the pull request:

    https://github.com/apache/storm/pull/827#issuecomment-159316692
  
    @satishd, @harshach ok perfect. So I will refactor API to remove 
Insert/Update builder. 
    Then I add a simple interface to map tuples to columns : 
    ```java
    public interface CqlMapper  extends Serializable {
        List<Column> getColumns(ITuple tuple);
    }
    ```
    In addition, I will implement a SimpleStatementMapper to build query as 
follows : 
    
    ```java
    new CassandraWriterBolt(
      async(
        simpleQuery("INSERT INTO weather.temperature (weatherstation_id, 
event_time, temperature) VALUES(?,?,?)"),with(field("weatherstation_id"), 
field("event_time").now(), field("temperature")));
      )
    );
    ```
    Same Bolt could be write with QueryBuilder : 
    ```java
    new CassandraWriterBolt(
      async(
    simple(
                    QueryBuilder.insertInto("weather", "temperature")
                            .value("weatherstation_id", "?")
                            .value("event_time", "?")
                            .value("temperature", "?")
                    ,
                    with(field("weatherstation_id"), field("event_time").now(), 
field("temperature")));
      )
    );
    ```
    What do you think about that ? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to