Package backtype.storm.tuple

Examples of backtype.storm.tuple.Values


   
    @SuppressWarnings({ "unchecked", "rawtypes" })
    private void testCassandraMapState(TransactionType txType) throws Exception {
        FixedBatchSpout spout = new FixedBatchSpout(
                new Fields("sentence"), 3,
                new Values("the cow jumped over the moon"),
                new Values("the man went to the store and bought some candy"),
                new Values("four score and seven years ago"),
                new Values("how many apples can you eat"));
        spout.setCycle(false);

        TridentTopology topology = new TridentTopology();

        HashMap<String, Object> clientConfig = new HashMap<String, Object>();
View Full Code Here


    private Values createEmptyValues() {
        ArrayList<Object> emptyValues = new ArrayList<Object>();
        for (int evc = 0; evc < this.numberOfOutputFields; evc++) {
            emptyValues.add("");
        }
        return new Values(emptyValues.toArray());
    }
View Full Code Here

        clientConfig.put(StormCassandraConstants.CASSANDRA_HOST, "localhost:9160");
        clientConfig.put(StormCassandraConstants.CASSANDRA_KEYSPACE, Arrays.asList(new String [] {KEYSPACE}));
        client.start(clientConfig);

        Fields fields = new Fields("key1", "key2", "foo", "bar");
        Values values = new Values("key1val", "key2val", "fooval", "barval");
        Tuple tuple = new MockTuple(fields, values);

        client.writeTuple(tuple, tupleMapper);

        AstyanaxContext<Keyspace> context = newContext("localhost:9160", KEYSPACE);
View Full Code Here

        clientConfig.put(StormCassandraConstants.CASSANDRA_HOST, "localhost:9160");
        clientConfig.put(StormCassandraConstants.CASSANDRA_KEYSPACE, Arrays.asList(new String [] {KEYSPACE}));
        client.start(clientConfig);
       
        Fields fields = new Fields("key1", "key2", "foo", "bar");
        Values values = new Values("key1val", "key2val", "fooval", "barval");
        TridentTuple tuple = newTridentTuple(fields, values);
       
        SimpleTridentTupleMapper tupleMapper = new SimpleTridentTupleMapper(KEYSPACE, fields);
       
        client.writeTuple(tuple, tupleMapper);
View Full Code Here

        clientConfig.put(StormCassandraConstants.CASSANDRA_HOST, "localhost:9160");
        clientConfig.put(StormCassandraConstants.CASSANDRA_KEYSPACE, Arrays.asList(new String [] {KEYSPACE}));
        client.start(clientConfig);
       
        Fields fields = new Fields("rowkey", "a", "b", "value");
        Values values = new Values("my_row", "a", "a", "aa");
        TridentTuple tuple = newTridentTuple(fields, values);
       
        CompositeColumnTridentTupleMapper tupleMapper = new CompositeColumnTridentTupleMapper(KEYSPACE);
       
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "b", "b", "bb"));
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "a", "b", "ab"));
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "a", "c", "ac"));
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "a", "d", "ad"));
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "c", "c", "cc"));
        client.writeTuple(tuple, tupleMapper);
       
        tuple = newTridentTuple(fields, new Values("my_row", "d", "d", "dd"));
        client.writeTuple(tuple, tupleMapper);
       
       
        Map<SimpleComposite, String> map = client.lookup(tupleMapper, tuple, new SimpleComposite("a", "a"), new SimpleComposite("a", "c"), Equality.GREATER_THAN_EQUAL);
        dumpMap(map);
View Full Code Here

    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        try {
            writeTuple(tuple);
            if (this.valueToEmit != null) {
                collector.emit(new Values(this.valueToEmit));
            }
        } catch (TupleMappingException e) {
            LOG.error("Skipping tuple: " + tuple, e);
        } catch (StormCassandraException e) {
            LOG.error("Failed to write tuple. Exception: " + e.getLocalizedMessage());
View Full Code Here

        if ( key == null ) {
            return deserialize(value);
        }
        String keyString = StringScheme.deserializeString(key);
        String valueString = StringScheme.deserializeString(value);
        return new Values(ImmutableMap.of(keyString, valueString));
    }
View Full Code Here

public class TridentKafkaTopology {

    private static StormTopology buildTopology() {
        Fields fields = new Fields("word", "count");
        FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
                new Values("storm", "1"),
                new Values("trident", "1"),
                new Values("needs", "1"),
                new Values("javadoc", "1")
        );
        spout.setCycle(true);

        TridentTopology topology = new TridentTopology();
        Stream stream = topology.newStream("spout1", spout);
View Full Code Here

public class BasicDRPCTopology {
  public static class ExclaimBolt extends BaseBasicBolt {
    @Override
    public void execute(Tuple tuple, BasicOutputCollector collector) {
      String input = tuple.getString(1);
      collector.emit(new Values(tuple.getValue(0), input + "!"));
    }
View Full Code Here

      }
    }
  }

  public static StormTopology buildTopology(LocalDRPC drpc) {
    FixedBatchSpout spout = new FixedBatchSpout(new Fields("sentence"), 3, new Values("the cow jumped over the moon"),
        new Values("the man went to the store and bought some candy"), new Values("four score and seven years ago"),
        new Values("how many apples can you eat"), new Values("to be or not to be the person"));
    spout.setCycle(true);

    TridentTopology topology = new TridentTopology();
    TridentState wordCounts = topology.newStream("spout1", spout).parallelismHint(16).each(new Fields("sentence"),
        new Split(), new Fields("word")).groupBy(new Fields("word")).persistentAggregate(new MemoryMapState.Factory(),
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.