Package com.alipay.dw.jstorm.example.sequence.bean

Examples of com.alipay.dw.jstorm.example.sequence.bean.Pair


     
      if (obj instanceof TradeCustomer) {
     
          TradeCustomer tradeCustomer = (TradeCustomer)obj;
         
          Pair trade = tradeCustomer.getTrade();
          Pair customer = tradeCustomer.getCustomer();
           
            collector.emit(SequenceTopologyDef.TRADE_STREAM_ID,
                    new Values(tupleId, trade));
           
            collector.emit(SequenceTopologyDef.CUSTOMER_STREAM_ID,
View Full Code Here


  public void execute(Tuple tuple, BasicOutputCollector collector) {
      tpsCounter.count();
     
    Long tupleId = tuple.getLong(0);
    Pair pair = (Pair)tuple.getValue(1);
       
        sum.addAndGet(pair.getValue());
       
        collector.emit(new Values(tupleId, pair));

  }
View Full Code Here

    public void execute(Tuple input) {
       
        tpsCounter.count();
       
        Long tupleId = input.getLong(0);
        Pair pair = (Pair) input.getValue(1);
       
        Pair trade = null;
        Pair customer = null;
       
        Tuple tradeTuple = null;
        Tuple customerTuple = null;
       
        if (input.getSourceComponent().equals(SequenceTopologyDef.CUSTOMER_BOLT_NAME) ) {
            customer = pair;
            customerTuple = input;
           
            tradeTuple = tradeMap.remove(tupleId);
            if (tradeTuple == null) {
                customerMap.put(tupleId, input);
                return;
            }
           
            trade = (Pair) tradeTuple.getValue(1);
           
        } else if (input.getSourceComponent().equals(SequenceTopologyDef.TRADE_BOLT_NAME)) {
            trade = pair;
            tradeTuple = input;
           
            customerTuple = customerMap.remove(tupleId);
            if (customerTuple == null) {
                tradeMap.put(tupleId, input);
                return;
            }
           
            customer = (Pair) customerTuple.getValue(1);
        } else {
            LOG.info("Unknow source component: " + input.getSourceComponent());
            collector.fail(input);
            return;
        }
       
        tradeSum.addAndGet(trade.getValue());
        customerSum.addAndGet(customer.getValue());
       
        collector.ack(tradeTuple);
        collector.ack(customerTuple);
       
        TradeCustomer tradeCustomer = new TradeCustomer();
View Full Code Here

     
      buffer = new String(byteBuffer);
    }
   

    Pair trade = PairMaker.makeTradeInstance();
    Pair customer = PairMaker.makeCustomerInstance();

    TradeCustomer tradeCustomer = new TradeCustomer();
    tradeCustomer.setTrade(trade);
    tradeCustomer.setCustomer(customer);
    tradeCustomer.setBuffer(buffer);

    tradeSum.addAndGet(trade.getValue());
    customerSum.addAndGet(customer.getValue());

    collector.emit(new Values(tupleId, tradeCustomer),
        Long.valueOf(tupleId));

    tupleId++;
View Full Code Here

TOP

Related Classes of com.alipay.dw.jstorm.example.sequence.bean.Pair

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.