Package net.kuujo.vertigo.cluster

Examples of net.kuujo.vertigo.cluster.Cluster


        // send handler will be called each time a message is sent on *any* port.
        network.addComponent("sender", TestSimpleSender.class.getName()).addHook(new TestComponentSendHook());
        network.addComponent("receiver", TestSimpleReceiver.class.getName());
        network.createConnection("sender", "out", "receiver", "in");

        Cluster cluster = result.result();
        cluster.deployNetwork(network, 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


        // The component hook is added directly to a component configuration. The
        // receive handler will be called each time a message is received on *any* port.
        network.addComponent("receiver", TestSimpleReceiver.class.getName()).addHook(new TestComponentReceiveHook());
        network.createConnection("sender", "out", "receiver", "in");

        Cluster cluster = result.result();
        cluster.deployNetwork(network, 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());
        final Cluster cluster = result.result();

        // Use the special EventBusHookListener to listen for messages
        // from the event bus hook. This will handle parsing event bus messages.
        final EventBusHookListener listener = new EventBusHookListener("test-hook", vertx.eventBus());
        listener.startHandler(new Handler<InstanceContext>() {
          @Override
          public void handle(InstanceContext context) {
            assertEquals("sender", context.component().name());
            testComplete();
          }
        });

        // The start() method simply registers an event bus handler for the hook.
        listener.start(new Handler<AsyncResult<Void>>() {
          @Override
          public void handle(AsyncResult<Void> result) {
            assertTrue(result.succeeded());

            NetworkConfig network = vertigo.createNetwork();
            network.addComponent("sender", TestSimpleSender.class.getName()).addHook(new EventBusHook("test-hook"));
            network.addComponent("receiver", TestSimpleReceiver.class.getName());
            network.createConnection("sender", "out", "receiver", "in");

            cluster.deployNetwork(network, 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());
        final Cluster cluster = result.result();

        // Use the special EventBusHookListener to listen for messages
        // from the event bus hook. This will handle parsing event bus messages.
        final EventBusHookListener listener = new EventBusHookListener("test-hook", vertx.eventBus());
        listener.sendHandler(new Handler<String>() {
          @Override
          public void handle(String message) {
            assertEquals("Hello world!", message);
            testComplete();
          }
        });

        // The start() method simply registers an event bus handler for the hook.
        listener.start(new Handler<AsyncResult<Void>>() {
          @Override
          public void handle(AsyncResult<Void> result) {
            assertTrue(result.succeeded());

            NetworkConfig network = vertigo.createNetwork();
            network.addComponent("sender", TestSimpleSender.class.getName()).addHook(new EventBusHook("test-hook"));
            network.addComponent("receiver", TestSimpleReceiver.class.getName());
            network.createConnection("sender", "out", "receiver", "in");

            cluster.deployNetwork(network, 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());
        final Cluster cluster = result.result();

        // Use the special EventBusHookListener to listen for messages
        // from the event bus hook. This will handle parsing event bus messages.
        final EventBusHookListener listener = new EventBusHookListener("test-hook", vertx.eventBus());
        listener.receiveHandler(new Handler<String>() {
          @Override
          public void handle(String message) {
            assertEquals("Hello world!", message);
            testComplete();
          }
        });

        // The start() method simply registers an event bus handler for the hook.
        listener.start(new Handler<AsyncResult<Void>>() {
          @Override
          public void handle(AsyncResult<Void> result) {
            assertTrue(result.succeeded());

            NetworkConfig network = vertigo.createNetwork();
            network.addComponent("sender", TestSimpleSender.class.getName());
            network.addComponent("receiver", TestSimpleReceiver.class.getName()).addHook(new EventBusHook("test-hook"));
            network.createConnection("sender", "out", "receiver", "in");

            cluster.deployNetwork(network, 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

    Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster("test", new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        final Cluster cluster = new DefaultCluster("test", vertx, container);
        final AsyncList<String> data = cluster.getList("test-list-get");
        data.add("foo", new Handler<AsyncResult<Boolean>>() {
          @Override
          public void handle(AsyncResult<Boolean> result) {
            assertTrue(result.succeeded());
            assertTrue(result.result());
View Full Code Here

    Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster("test", new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        final Cluster cluster = new DefaultCluster("test", vertx, container);
        final AsyncList<String> data = cluster.getList("test-list-contains");
        data.contains("foo", new Handler<AsyncResult<Boolean>>() {
          @Override
          public void handle(AsyncResult<Boolean> result) {
            assertTrue(result.succeeded());
            assertFalse(result.result());
View Full Code Here

    Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster("test", new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        final Cluster cluster = new DefaultCluster("test", vertx, container);
        final AsyncList<String> data = cluster.getList("test-list-size");
        data.add("foo", new Handler<AsyncResult<Boolean>>() {
          @Override
          public void handle(AsyncResult<Boolean> result) {
            assertTrue(result.succeeded());
            assertTrue(result.result());
View Full Code Here

    Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster("test", new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        final Cluster cluster = new DefaultCluster("test", vertx, container);
        final AsyncList<String> data = cluster.getList("test-list-remove-by-value");
        data.add("foo", new Handler<AsyncResult<Boolean>>() {
          @Override
          public void handle(AsyncResult<Boolean> result) {
            assertTrue(result.succeeded());
            assertTrue(result.result());
View Full Code Here

    Vertigo vertigo = new Vertigo(this);
    vertigo.deployCluster("test", new Handler<AsyncResult<Cluster>>() {
      @Override
      public void handle(AsyncResult<Cluster> result) {
        assertTrue(result.succeeded());
        final Cluster cluster = new DefaultCluster("test", vertx, container);
        final AsyncList<String> data = cluster.getList("test-list-remove-by-index");
        data.add("foo", new Handler<AsyncResult<Boolean>>() {
          @Override
          public void handle(AsyncResult<Boolean> result) {
            assertTrue(result.succeeded());
            assertTrue(result.result());
View Full Code Here

TOP

Related Classes of net.kuujo.vertigo.cluster.Cluster

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.