Java Code Examples for backtype.storm.tuple.Tuple#contains()
The following examples show how to use
backtype.storm.tuple.Tuple#contains() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockSinkBolt.java From flowmix with Apache License 2.0 | 5 votes |
@Override public void execute(Tuple tuple) { if(tuple.contains(EVENT)) { synchronized (eventsReceived) { eventsReceived.add((Event) tuple.getValueByField(EVENT)); } } }
Example 2
Source File: FlowInfo.java From flowmix with Apache License 2.0 | 5 votes |
public FlowInfo(Tuple tuple) { flowId = tuple.getStringByField(FLOW_ID); event = (Event) tuple.getValueByField(EVENT); idx = tuple.getIntegerByField(FLOW_OP_IDX); idx++; streamName = tuple.getStringByField(STREAM_NAME); previousStream = tuple.getStringByField(LAST_STREAM); if(tuple.contains(PARTITION)) partition = tuple.getStringByField(PARTITION); }
Example 3
Source File: DefaultTupleMapper.java From storm-trident-elasticsearch with Apache License 2.0 | 5 votes |
@Override public Document<String> map(Tuple input) { String id = input.getStringByField(FIELD_ID); String name = input.getStringByField(FIELD_NAME); String type = input.getStringByField(FIELD_TYPE); String parentId = ( input.contains(FIELD_PARENT_ID) ) ? input.getStringByField(FIELD_PARENT_ID) : null; return new Document<>(name, type, sourceMapperStrategy.map(input), id, parentId); }
Example 4
Source File: KafkaBolt.java From storm-kafka-0.8-plus with Apache License 2.0 | 5 votes |
@Override public void execute(Tuple input) { K key = null; if (input.contains(BOLT_KEY)) { key = (K) input.getValueByField(BOLT_KEY); } V message = (V) input.getValueByField(BOLT_MESSAGE); try { producer.send(new KeyedMessage<K, V>(topic, key, message)); } catch (Exception ex) { LOG.error("Could not send message with key '" + key + "' and value '" + message + "'", ex); } finally { collector.ack(input); } }