Package net.kuujo.vertigo.network

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


      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

      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

      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

      @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

    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();
        network.addVerticle("sender", TestOneToNoneBatchSender.class.getName());
        network.createConnection("sender", "out", "receiver", "in").roundSelect();
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
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();
        network.addVerticle("sender", TestBasicBatchSender.class.getName());
        network.addVerticle("receiver", TestBasicBatchReceiver.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());
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();
        network.addVerticle("sender", TestOneToManyBatchSender.class.getName());
        network.addVerticle("receiver", TestOneToManyBatchReceiver.class.getName(), 4);
        network.createConnection("sender", "out", "receiver", "in").roundSelect();
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
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();
        network.addVerticle("sender", TestBatchesSender.class.getName());
        network.addVerticle("receiver", TestBatchesReceiver.class.getName());
        network.createConnection("sender", "out", "receiver", "in").roundSelect();
        result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
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();
        network.addVerticle("sender", TestBatchForwardSender.class.getName());
        network.addVerticle("forwarder", TestBatchForwarder.class.getName());
        network.addVerticle("receiver", TestBatchForwardReceiver.class.getName());
        network.createConnection("sender", "out", "forwarder", "in");
        network.createConnection("forwarder", "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());
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.