Examples of NetworkConfig


Examples of net.kuujo.vertigo.network.NetworkConfig

  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

Examples of net.kuujo.vertigo.network.NetworkConfig

  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

Examples of net.kuujo.vertigo.network.NetworkConfig

  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

Examples of net.kuujo.vertigo.network.NetworkConfig

  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

Examples of net.kuujo.vertigo.network.NetworkConfig

    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

Examples of net.kuujo.vertigo.network.NetworkConfig

    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", TestFileSender.class.getName());
        network.addVerticle("receiver", TestFileReceiver.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

Examples of net.kuujo.vertigo.network.NetworkConfig

      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());

        // Create a randomly named partial network. This network will have only
        // a single component and a connection that doesn't go anywhere.
        NetworkConfig network = vertigo.createNetwork();
        network.addVerticle("sender", TestActiveSender.class.getName());
        network.createConnection("sender", "out", "receiver", "in");

        // Deploy the partial network. Even though the network has a connection that
        // doesn't actually go anywhere, the "sender" component will still thing the
        // connection exists, and it will try to open the connection until a component
        // that can listen on the connection joins the network.
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
            } else {
              // Add a "receiver" verticle to the network. The "receiver" verticle should
              // automatically be connected to the existing connection once it's deployed.
              ActiveNetwork network = result.result();
              network.addVerticle("receiver", TestActiveReceiver.class.getName(), new Handler<AsyncResult<ActiveNetwork>>() {
                @Override
                public void handle(AsyncResult<ActiveNetwork> result) {
                  if (result.failed()) {
                    assertTrue(result.cause().getMessage(), result.succeeded());
                  } else {
View Full Code Here

Examples of net.kuujo.vertigo.network.NetworkConfig

      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());

        // Create a randomly named network. This network will be a complete
        // network that we'll later alter once it's deployed.
        NetworkConfig network = vertigo.createNetwork();
        network.addVerticle("sender", TestSimpleSender.class.getName());
        network.addVerticle("receiver", TestSimpleReceiver.class.getName());
        network.createConnection("sender", "out", "receiver", "in");
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
            } else {
              // Remote a verticle from the network through the ActiveNetwork.
              ActiveNetwork network = result.result();
              network.removeVerticle("receiver", new Handler<AsyncResult<ActiveNetwork>>() {
                @Override
                public void handle(AsyncResult<ActiveNetwork> result) {
                  if (result.failed()) {
                    assertTrue(result.cause().getMessage(), result.succeeded());
                  } else {
View Full Code Here

Examples of net.kuujo.vertigo.network.NetworkConfig

      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());

        // Create a randomly named partial network. This is a network that has
        // two components but no connections.
        NetworkConfig network = vertigo.createNetwork();
        network.addVerticle("sender", TestActiveSender.class.getName());
        network.addVerticle("receiver", TestActiveReceiver.class.getName());

        // When the network is deployed, the components will be deployed as normal,
        // but they won't be able to communicate with each other since there's no
        // connection on the network. Sending messages to the "sender"s "out" port
        // will simply result in the messages disappearing.
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
            } else {
              // Now create a connection on the network. Both the "sender" and the
              // "receiver" component will be automatically updated with the new
              // connection, and messages send to the "sender"s "out" port will
              // be sent to the "receiver"s "in" port.
              ActiveNetwork network = result.result();
              network.createConnection("sender", "out", "receiver", "in", new Handler<AsyncResult<ActiveNetwork>>() {
                @Override
                public void handle(AsyncResult<ActiveNetwork> result) {
                  if (result.failed()) {
                    assertTrue(result.cause().getMessage(), result.succeeded());
                  } else {
View Full Code Here

Examples of net.kuujo.vertigo.network.NetworkConfig

      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());

        // Create a randomly named complete network.
        NetworkConfig network = vertigo.createNetwork();
        network.addVerticle("sender", TestSimpleSender.class.getName());
        network.addVerticle("receiver", TestSimpleReceiver.class.getName());
        network.createConnection("sender", "out", "receiver", "in");
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
            } else {
              // Destroy the connection between the "sender" and "receiver". Once
              // the connection is destroyed the sender will no longer be able to
              // send messages to the receiver and messages sent on its "out" port
              // will simply be discarded.
              ActiveNetwork network = result.result();
              network.destroyConnection("sender", "out", "receiver", "in", new Handler<AsyncResult<ActiveNetwork>>() {
                @Override
                public void handle(AsyncResult<ActiveNetwork> result) {
                  if (result.failed()) {
                    assertTrue(result.cause().getMessage(), result.succeeded());
                  } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.