Package backtype.storm.task

Examples of backtype.storm.task.TopologyContext


        TailSpout spout = new TailSpout(spf, statusFile, tempDir, inPattern);
        spout.setReliableMode(true);

        // open spout
        Config conf = new Config();
        TopologyContext context = null;
        TestSpoutOutputCollector collector = new TestSpoutOutputCollector();
        spout.open(conf, context, collector);
       
        // add some files
        FileUtils.writeByteArrayToFile(new File(tempDir, "x-1"), payload("x-1"), true);
View Full Code Here


    Shutdownable    virtual_port_shutdown = virtual_port.launch();

   
   

    TopologyContext systemTopology = systemContext.make(null);

    // ˢ������
    RefreshConnections refreshConn = makeRefreshConnections(taskids);
    refreshConn.run();
View Full Code Here

    Set<Integer> rtn = null;
    if (task_ids != null) {
      rtn= new HashSet<Integer>();
      for (Integer taskid : task_ids) {
        TopologyContext context = mk_topology_context.make(taskid);
        if(context!=null){
          // <StreamId,<ComponentId,Grouping>>
          Map<String, Map<String, Grouping>> targets = context.getThisTargets();
          for (Map<String, Grouping> e : targets.values()) {
            for (String componentId : e.keySet()) {
              List<Integer> tasks= context.getComponentTasks(componentId);
              rtn.addAll(tasks);
            }
          } 
        }
      } 
View Full Code Here

    this.workerId = worker_id;
    this.tasksToComponent = tasksToComponent;
  }

  public TopologyContext make(Integer task_id) {
    TopologyContext rtn = null;
    try {
      StormTopology systopology = Common.system_topology(stormConf,topology);
      String distroot = StormConfig.supervisor_stormdist_root(stormConf,topologyId);
      String resourcePath = StormConfig.supervisor_storm_resources_path(distroot);
      String workpid = StormConfig.worker_pids_root(stormConf, workerId);
      rtn = new TopologyContext(systopology, tasksToComponent, topologyId,resourcePath, workpid, task_id);
    } catch (Exception e) {
      LOG.error("SystemContextMake make", e);
    }
    return rtn;
  }
View Full Code Here

    this.worker_id = worker_id;
    this.tasksToComponent = tasks_component;
  }

  public TopologyContext make(Integer task_id) {
    TopologyContext rtn=null;
    try {
      String distroot = StormConfig.supervisor_stormdist_root(storm_conf,topologyId);
      String resourcePath = StormConfig.supervisor_storm_resources_path(distroot);
      String workpid = StormConfig.worker_pids_root(storm_conf, worker_id);   
      rtn = new TopologyContext(topology, tasksToComponent, topologyId,
          resourcePath, workpid, task_id);
    } catch (IOException e) {
      LOG.error("UserContextMake make", e);
    }
    return rtn;
View Full Code Here

        CassandraBatchingBolt<String, String, String> bolt = new CassandraBatchingBolt<String, String, String>(configKey, tupleMapper);
        TopologyBuilder builder = new TopologyBuilder();
        builder.setBolt("TEST_BOLT", bolt);

        Fields fields = new Fields("VALUE");
        TopologyContext context = new MockTopologyContext(builder.createTopology(), fields);

        Config config = new Config();
        config.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 5000);
       
        Map<String, Object> clientConfig = new HashMap<String, Object>();
View Full Code Here

        CassandraCounterBatchingBolt<String, String,Long> bolt = new CassandraCounterBatchingBolt<String, String, Long>(KEYSPACE, configKey, "Counts", "Timestamp", "IncrementAmount");
        TopologyBuilder builder = new TopologyBuilder();
        builder.setBolt("TEST__COUNTER_BOLT", bolt);

        Fields fields = new Fields("Timestamp", "IncrementAmount", "CounterColumn");
        TopologyContext context = new MockTopologyContext(builder.createTopology(), fields);

        Config config = new Config();
        config.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 5000);
       
        Map<String, Object> clientConfig = new HashMap<String, Object>();
View Full Code Here

  public void shouldEmitNothingIfNoObjectHasBeenCountedYetAndTickTupleIsReceived() {
    // given
    Tuple tickTuple = MockTupleHelpers.mockTickTuple();
    RollingCountBolt bolt = new RollingCountBolt();
    Map conf = mock(Map.class);
    TopologyContext context = mock(TopologyContext.class);
    OutputCollector collector = mock(OutputCollector.class);
    bolt.prepare(conf, context, collector);

    // when
    bolt.execute(tickTuple);
View Full Code Here

    Tuple normalTuple = mockNormalTuple(new Object());
    Tuple tickTuple = MockTupleHelpers.mockTickTuple();

    RollingCountBolt bolt = new RollingCountBolt();
    Map conf = mock(Map.class);
    TopologyContext context = mock(TopologyContext.class);
    OutputCollector collector = mock(OutputCollector.class);
    bolt.prepare(conf, context, collector);

    // when
    bolt.execute(normalTuple);
View Full Code Here

  public void shouldEmitNothingIfNoObjectHasBeenCountedYetAndTickTupleIsReceived() {
    // given
    Tuple tickTuple = MockTupleHelpers.mockTickTuple();
    RollingCountBolt bolt = new RollingCountBolt();
    Map conf = mock(Map.class);
    TopologyContext context = mock(TopologyContext.class);
    OutputCollector collector = mock(OutputCollector.class);
    bolt.prepare(conf, context, collector);

    // when
    bolt.execute(tickTuple);
View Full Code Here

TOP

Related Classes of backtype.storm.task.TopologyContext

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.