Package backtype.storm.tuple

Examples of backtype.storm.tuple.Values


      LOG.info("TopologyKiller: Received EOF from all the registered tasks. Killing cluster...");
      // EVENT WHEN ALL THE SPOUTS FINISHED EMITTING AND ACKED or
      // WHEN ALL THE TASKS FROM THE LAST COMPONENTS SENT EOF SIGNAL
      // Instruct all the components for which printOut is set to dump
      // their results
      _collector.emit(SystemParameters.DUMP_RESULTS_STREAM, new Values(
          SystemParameters.DUMP_RESULTS));

      long timeout = SystemParameters.LOCAL_SLEEP_BEFORE_KILL_MILLIS;
      if (SystemParameters.getBoolean(_conf, "DIP_DISTRIBUTED")) {
        // write down statistics (the same which is shown in Storm UI
View Full Code Here


    final String inputTupleHash = stormTupleRcv.getString(2); // Hash Tuple
    // / now processing
    if (_firstEmitterIndex.equals(inputComponentIndex)) {
      if (_currentRelationPointer == 1) { // it is the right tuple
        // send right away
        _collector.emit(new Values(inputComponentIndex, MyUtilities.stringToTuple(
            inputTupleString, _conf), inputTupleHash));
        _currentCount++;
        _relation1Count++;
        // LOG.info("Emitting 1: ("+_relation1Count+","+_relation2Count+")");

        // now check if a switch should happen
        if ((_currentCount == _currentAccCount) && (!_isSecondFinished)) {
          _currentRelationPointer = 2;
          _currentCount = 0;
          _currentAccCountALL = _relation1Count * _multFactor;
          _currentAccCount = _currentAccCountALL - _relation2Count;
        }
      } else { // it is the other tuple
        bufferedTuplesRel1.add(new BufferedTuple(inputComponentIndex, inputTupleString,
            inputTupleHash));
        // emit a buffered tuple from the second relation if exists
        if (!bufferedTuplesRel2.isEmpty()) {
          final BufferedTuple bufTup = bufferedTuplesRel2.removeFirst();
          _collector
              .emit(new Values(bufTup.get_componentName(), MyUtilities.stringToTuple(
                  bufTup.get_tupleString(), _conf), bufTup.get_tupleHash()));
          _currentCount++;
          _relation2Count++;
          // LOG.info("Emitting 2: ("+_relation1Count+","+_relation2Count+")");
          // now check if a switch should happen
          if ((_currentCount == _currentAccCount) && (!_isFirstFinished)) {
            _currentRelationPointer = 1;
            _currentCount = 0;
            _currentAccCountALL = _relation2Count * _multFactor;
            _currentAccCount = _currentAccCountALL - _relation1Count;
          }
        }
      }

    } else if (_secondEmitterIndex.equals(inputComponentIndex))
      if (_currentRelationPointer == 2) {
        // send right away
        _collector.emit(new Values(inputComponentIndex, MyUtilities.stringToTuple(
            inputTupleString, _conf), inputTupleHash));
        _currentCount++;
        _relation2Count++;
        // LOG.info("Emitting 2: ("+_relation1Count+","+_relation2Count+")");

        // now check if a switch should happen
        if ((_currentCount == _currentAccCount) && (!_isFirstFinished)) {
          _currentRelationPointer = 1;
          _currentCount = 0;
          _currentAccCountALL = _relation2Count * _multFactor;
          _currentAccCount = _currentAccCountALL - _relation1Count;
        }
      } else { // it is the other tuple
        bufferedTuplesRel2.add(new BufferedTuple(inputComponentIndex, inputTupleString,
            inputTupleHash));
        // emit a buffered tuple from the second relation if exists
        if (!bufferedTuplesRel1.isEmpty()) {
          final BufferedTuple bufTup = bufferedTuplesRel1.removeFirst();
          _collector
              .emit(new Values(bufTup.get_componentName(), MyUtilities.stringToTuple(
                  bufTup.get_tupleString(), _conf), bufTup.get_tupleHash()));
          _currentCount++;
          _relation1Count++;
          // LOG.info("Emitting 1: ("+_relation1Count+","+_relation2Count+")");
          // now check if a switch should happen
View Full Code Here

    _collector.ack(stormTupleRcv);
  }

  private void flush(LinkedList<BufferedTuple> buffer) {
    for (final BufferedTuple bufTup : buffer)
      _collector.emit(new Values(bufTup.get_componentName(), MyUtilities.stringToTuple(
          bufTup.get_tupleString(), _conf), bufTup.get_tupleHash()));
    buffer.clear();
  }
View Full Code Here

      if (getHierarchyPosition() == FINAL_COMPONENT) {
        if (!_hasSentEOF) {
          _hasSentEOF = true; // to ensure we will not send multiple
          // EOF per single spout
          getCollector().emit(SystemParameters.EOF_STREAM,
              new Values(SystemParameters.EOF));
        }
      } else if (!_hasSentLastAck) {
        LOG.info(getID() + ":Has sent last_ack, tuples sent:" + _numSentTuples);
        _hasSentLastAck = true;
        final List<String> lastTuple = new ArrayList<String>(
View Full Code Here

    if (MyUtilities.isAckEveryTuple(getConf()))
      if (_pendingTuples == 0)
        if (!_hasSentEOF) {
          _hasSentEOF = true;
          getCollector().emit(SystemParameters.EOF_STREAM,
              new Values(SystemParameters.EOF));
        }
  }
View Full Code Here

      outputFields.add(StormComponent.TIMESTAMP);
    declarer.declareStream(SystemParameters.DATA_STREAM, new Fields(outputFields));
  }

  private void finalAckSend() {
    final Values values = MyUtilities.createUniversalFinalAckTuple(_conf);
    _collector.emit(values);
  }
View Full Code Here

      _targetBuffers[i] = new StringBuilder("");

      if (!tupleString.isEmpty())
        // some buffers might be empty
        if (MyUtilities.isCustomTimestampMode(_conf))
          _collector.emit(new Values(_componentIndex, tupleString, _targetTimestamps[i]));
        else
          _collector.emit(new Values(_componentIndex, tupleString));
    }
  }
View Full Code Here

  }

  // HELPER METHODS
  // non-ManualBatchMode
  private void regularTupleSend(List<String> tuple, long timestamp) {
    final Values stormTupleSnd = MyUtilities.createTupleValues(tuple, timestamp,
        _componentIndex, _hashIndexes, _hashExpressions, _conf);
    MyUtilities.sendTuple(stormTupleSnd, _collector, _conf);
  }
View Full Code Here

  }

  @Override
  public void tupleSend(List<String> tuple, Tuple stormTupleRcv, long timestamp) {
    final Values stormTupleSnd = MyUtilities.createTupleValues(tuple, timestamp,
        _componentIndex, _hashIndexes, _hashExpressions, _conf);
    MyUtilities.sendTuple(stormTupleSnd, stormTupleRcv, _collector, _conf);
  }
View Full Code Here

    if (!MyUtilities.isAckEveryTuple(_conf))
      if (_hierarchyPosition == FINAL_COMPONENT) {
        if (!_hasSentEOF) {
          _hasSentEOF = true; // to ensure we will not send multiple
          // EOF per single spout
          _collector.emit(SystemParameters.EOF_STREAM, new Values(SystemParameters.EOF));
        }
      } else if (!_hasSentLastAck) {
        _hasSentLastAck = true;
        final List<String> lastTuple = new ArrayList<String>(
            Arrays.asList(SystemParameters.LAST_ACK));
        _collector.emit(new Values("N/A", lastTuple, "N/A"));
      }
  }
View Full Code Here

TOP

Related Classes of backtype.storm.tuple.Values

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.