Search in sources :

Example 1 with StreamInfo

use of backtype.storm.generated.StreamInfo in project storm by nathanmarz.

the class ClojureBolt method declareOutputFields.

@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    for (String stream : _fields.keySet()) {
        StreamInfo info = _fields.get(stream);
        declarer.declareStream(stream, info.is_direct(), new Fields(info.get_output_fields()));
    }
}
Also used : Fields(backtype.storm.tuple.Fields) StreamInfo(backtype.storm.generated.StreamInfo)

Example 2 with StreamInfo

use of backtype.storm.generated.StreamInfo in project jstorm by alibaba.

the class WorkerData method generateComponentToStreamToFields.

public HashMap<String, Map<String, Fields>> generateComponentToStreamToFields(StormTopology topology) {
    HashMap<String, Map<String, Fields>> componentToStreamToFields = new HashMap<String, Map<String, Fields>>();
    Set<String> components = ThriftTopologyUtils.getComponentIds(topology);
    for (String component : components) {
        Map<String, Fields> streamToFieldsMap = new HashMap<String, Fields>();
        Map<String, StreamInfo> streamInfoMap = ThriftTopologyUtils.getComponentCommon(topology, component).get_streams();
        for (Map.Entry<String, StreamInfo> entry : streamInfoMap.entrySet()) {
            String streamId = entry.getKey();
            StreamInfo streamInfo = entry.getValue();
            streamToFieldsMap.put(streamId, new Fields(streamInfo.get_output_fields()));
        }
        componentToStreamToFields.put(component, streamToFieldsMap);
    }
    return componentToStreamToFields;
}
Also used : Fields(backtype.storm.tuple.Fields) StreamInfo(backtype.storm.generated.StreamInfo)

Example 3 with StreamInfo

use of backtype.storm.generated.StreamInfo in project jstorm by alibaba.

the class ClojureSpout method declareOutputFields.

@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    for (String stream : _fields.keySet()) {
        StreamInfo info = _fields.get(stream);
        declarer.declareStream(stream, info.is_direct(), new Fields(info.get_output_fields()));
    }
}
Also used : Fields(backtype.storm.tuple.Fields) StreamInfo(backtype.storm.generated.StreamInfo)

Example 4 with StreamInfo

use of backtype.storm.generated.StreamInfo in project jstorm by alibaba.

the class TransactionOutputFieldsDeclarer method declareStream.

public void declareStream(String streamId, boolean direct, Fields fields) {
    if (_fields.containsKey(streamId)) {
        throw new IllegalArgumentException("Fields for " + streamId + " already set");
    }
    List<String> fieldList = new ArrayList<String>();
    fieldList.add(TransactionCommon.BATCH_GROUP_ID_FIELD);
    fieldList.addAll(fields.toList());
    _fields.put(streamId, new StreamInfo(fieldList, direct));
}
Also used : ArrayList(java.util.ArrayList) StreamInfo(backtype.storm.generated.StreamInfo)

Example 5 with StreamInfo

use of backtype.storm.generated.StreamInfo in project jstorm by alibaba.

the class TransactionSpout method declareOutputFields.

@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    declarer.declareStream(TransactionCommon.BARRIER_STREAM_ID, new Fields(TransactionCommon.BATCH_GROUP_ID_FIELD, TransactionCommon.BARRIER_SNAPSHOT_FIELD));
    TransactionOutputFieldsDeclarer transactionDeclarer = new TransactionOutputFieldsDeclarer();
    spoutExecutor.declareOutputFields(transactionDeclarer);
    Map<String, StreamInfo> streams = transactionDeclarer.getFieldsDeclaration();
    for (Entry<String, StreamInfo> entry : streams.entrySet()) {
        String streamName = entry.getKey();
        StreamInfo streamInfo = entry.getValue();
        declarer.declareStream(streamName, streamInfo.is_direct(), new Fields(streamInfo.get_output_fields()));
    }
}
Also used : Fields(backtype.storm.tuple.Fields) TransactionOutputFieldsDeclarer(com.alibaba.jstorm.transactional.TransactionOutputFieldsDeclarer) StreamInfo(backtype.storm.generated.StreamInfo)

Aggregations

StreamInfo (backtype.storm.generated.StreamInfo)12 Fields (backtype.storm.tuple.Fields)11 OutputFieldsGetter (backtype.storm.topology.OutputFieldsGetter)4 CoordinatedBolt (backtype.storm.coordination.CoordinatedBolt)2 FinishedCallback (backtype.storm.coordination.CoordinatedBolt.FinishedCallback)2 IdStreamSpec (backtype.storm.coordination.CoordinatedBolt.IdStreamSpec)2 SourceArgs (backtype.storm.coordination.CoordinatedBolt.SourceArgs)2 BoltDeclarer (backtype.storm.topology.BoltDeclarer)2 IRichBolt (backtype.storm.topology.IRichBolt)2 TopologyBuilder (backtype.storm.topology.TopologyBuilder)2 TransactionOutputFieldsDeclarer (com.alibaba.jstorm.transactional.TransactionOutputFieldsDeclarer)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ArrayList (java.util.ArrayList)1