需要cassandrabolt类描述

cx6n0qe3  于 2021-06-24  发布在  Storm
关注(0)|答案(0)|浏览(207)

下面是cassadrabolt类的源代码,它从testwordcounter类接收元组(word,count)。我想知道源代码中的元组到底发生了什么。还需要对writetuple()函数、prepare()函数、tuplemapper、incrementcounter()函数进行说明。请给我解决办法。这个问题可能很傻,但我需要那个。所以提前谢谢你//源代码

private String clientConfigKey;

protected AstyanaxClient<K, C, V> client;

protected TupleMapper<K, C, V> tupleMapper;
protected Map<String, Object> stormConfig;

public CassandraBolt(String clientConfigKey, TupleMapper<K, C, V> tupleMapper) 
{
this.tupleMapper = tupleMapper;
// this.columnNameClass = columnNameClass;
// this.columnValueClass = columnValueClass;
this.clientConfigKey = clientConfigKey;

    LOG.debug("Creating Cassandra Bolt (" + this + ")");
}

@SuppressWarnings("unchecked")
public void prepare(Map<String, Object> stormConf, TopologyContext context) {
    Map<String, Object> config = (Map<String, Object>) stormConf.get(this.clientConfigKey);
    this.client = new AstTupleMapperyanaxClient<K, C, V>();
    this.client.start(config);
}

public void cleanup() {
    this.client.stop();
}

public void writeTuple(Tuple input, TupleMapper<K, C, V> tupleMapper) throws Exception {
    this.client.writeTuple(input, tupleMapper);
}

public void writeTuples(List<Tuple> inputs, TupleMapper<K, C, V> tupleMapper) throws Exception {
    this.client.writeTuples(inputs, tupleMapper);
}

public Map<String, Object> getComponentConfiguration() {
    return null;
}

public void incrementCounter(Tuple input, TupleCounterMapper tupleMapper) throws Exception {
    this.client.incrementCountColumn(input, tupleMapper);
}

public void incrementCounters(List<Tuple> inputs, TupleCounterMapper tupleMapper) throws Exception {
    this.client.incrementCountColumns(inputs, tupleMapper);
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题