Package net.kuujo.vertigo.network

Examples of net.kuujo.vertigo.network.NetworkConfig


    final Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster(UUID.randomUUID().toString(), new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        NetworkConfig network = vertigo.createNetwork("test");
        network.addVerticle("counter", WordCountNetwork.WordCounter.class.getName());
        network.addVerticle("tester", CountTester.class.getName());
        network.createConnection("counter", "count", "tester", "in");
        network.createConnection("tester", "out", "counter", "word");
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            assertTrue(result.succeeded());
          }
View Full Code Here


          Cluster cluster = result.result();

          // Create a new network configuration. This network uses
          // circular connections to send "ack" messages back to the
          // FaultTolerantFeeder from the MessageReceiver.
          NetworkConfig network = vertigo.createNetwork("fault-tolerant");
          network.addVerticle("sender", FaultTolerantFeeder.class.getName());
          network.addVerticle("receiver", MessageReceiver.class.getName());
          network.createConnection("sender", "out", "receiver", "in");
          network.createConnection("receiver", "ack", "sender", "ack");

          // Deploy the network to the cluster. Once all the components
          // in the network have been started and all the connections
          // are successfully communicating with one another the async
          // handler will be called.
View Full Code Here

    assertNotNull(verticleContext.instances().get(0).component());
  }

  @Test
  public void testUpdateContext() {
    NetworkConfig network = new DefaultNetworkConfig("test");
    network.addVerticle("sender", "sender.py", 2);
    NetworkContext context = ContextBuilder.buildContext(network, "vertigo");
    NetworkConfig network2 = new DefaultNetworkConfig("test");
    network2.addVerticle("receiver", "receiver.py", 2);
    NetworkContext context2 = ContextBuilder.buildContext(network2, "vertigo");
    assertNotNull(context2.component("receiver"));
    context.notify(context2);
    assertNotNull(context.component("receiver"));
  }
View Full Code Here

  public <T extends ComponentConfig<T>> T removeComponent(String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    // Undeploy a single component by creating a copy of the network with the
    // component as its only element. When then network is undeployed, the component
    // will be removed from the network.
    T component = network.<T>removeComponent(name);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.addComponent(component);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

  public ModuleConfig removeModule(String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    // Undeploy a single module by creating a copy of the network with the
    // module as its only element. When then network is undeployed, the module
    // will be removed from the network.
    ModuleConfig module = network.removeModule(name);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.addModule(module);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

  public VerticleConfig removeVerticle(String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    // Undeploy a single verticle by creating a copy of the network with the
    // verticle as its only element. When then network is undeployed, the verticle
    // will be removed from the network.
    VerticleConfig verticle = network.removeVerticle(name);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.addVerticle(verticle);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

  public ActiveNetwork destroyConnection(ConnectionConfig connection, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
     // Undeploy a single connection by creating a copy of the network with the
    // connection as its only element. When then network is undeployed, the connection
    // will be removed from the network.
    network.destroyConnection(connection);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.createConnection(connection);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

  public ActiveNetwork destroyConnection(String source, String target, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    // Undeploy a single connection by creating a copy of the network with the
    // connection as its only element. When then network is undeployed, the connection
    // will be removed from the network.
    network.destroyConnection(source, target);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.createConnection(source, target);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

  public ActiveNetwork destroyConnection(String source, String out, String target, String in, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    // Undeploy a single connection by creating a copy of the network with the
    // connection as its only element. When then network is undeployed, the connection
    // will be removed from the network.
    network.destroyConnection(source, target);
    NetworkConfig undeploy = new DefaultNetworkConfig(network.getName());
    undeploy.createConnection(source, out, target, in);
    cluster.undeployNetwork(undeploy, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
View Full Code Here

    final Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster(new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        NetworkConfig network = vertigo.createNetwork("test");
        network.addVerticle("sender", TestFeederSender.class.getName());
        network.addVerticle("receiver", TestFeederReceiver.class.getName(), 4);
        network.createConnection("sender", "out", "receiver", "in").setSelector(new RoundRobinSelector());
        Cluster cluster = result.result();
        cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
View Full Code Here

TOP

Related Classes of net.kuujo.vertigo.network.NetworkConfig

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.