Java Code Examples for io.vlingo.actors.World#start()

The following examples show how to use io.vlingo.actors.World#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceTestFixtures.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  world = World.start(WORLD_NAME);

  actionPostUser = new Action(0, "POST", "/users", "register(body:io.vlingo.http.sample.user.UserData userData)", null);
  actionPatchUserContact = new Action(1, "PATCH", "/users/{userId}/contact", "changeContact(String userId, body:io.vlingo.http.sample.user.ContactData contactData)", null);
  actionPatchUserName = new Action(2, "PATCH", "/users/{userId}/name", "changeName(String userId, body:io.vlingo.http.sample.user.NameData nameData)", null);
  actionGetUser = new Action(3, "GET", "/users/{userId}", "queryUser(String userId)", null);
  actionGetUsers = new Action(4, "GET", "/users", "queryUsers()", null);
  actionGetUserError = new Action(5, "GET", "/users/{userId}/error", "queryUserError(String userId)", null);
  actionPutUser = new Action(6, "PUT", "/users/{userId}", "changeUser(String userId, body:io.vlingo.http.sample.user.UserData userData)", null);


  final List<Action> actions =
          Arrays.asList(
                  actionPostUser,
                  actionPatchUserContact,
                  actionPatchUserName,
                  actionGetUser,
                  actionGetUsers,
                  actionGetUserError,
                  actionPutUser);

  resourceHandlerClass = ConfigurationResource.newResourceHandlerClassFor("io.vlingo.http.sample.user.UserResource");

  resource = ConfigurationResource.newResourceFor("user", resourceHandlerClass, 7, actions);

  resource.allocateHandlerPool(world.stage());

  final Map<String, Resource<?>> oneResource = new HashMap<>(1);

  oneResource.put(resource.name, resource);

  resources = new Resources(oneResource);
  dispatcher = new TestDispatcher(resources, world.defaultLogger());
}
 
Example 2
Source File: ServerBootstrap.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
private ServerBootstrap() {
  world = World.start("vlingo-http-server");

  final UserResourceFluent userResource = new UserResourceFluent(world);
  final ProfileResourceFluent profileResource = new ProfileResourceFluent(world);
  final Resource<?> r1 = userResource.routes();
  final Resource<?> r2 = profileResource.routes();
  final Resources resources = Resources.are(r1, r2);

  server =
          Server.startWith(
                  world.stage(),
                  resources,
                  Filters.none(),
                  8081,
                  Sizing.defineWith(4, 10, 100, 10240),
                  Timing.defineWith(3, 1, 100),
                  "arrayQueueMailbox",
                  "arrayQueueMailbox");

  Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
      if (instance != null) {
        instance.server.stop();

        System.out.println("\n");
        System.out.println("==============================");
        System.out.println("Stopping vlingo/http Server...");
        System.out.println("==============================");
      }
    }
  });
}
 
Example 3
Source File: Bootstrap.java    From vlingo-examples with Mozilla Public License 2.0 4 votes vote down vote up
public static void main(final String[] args) throws Exception {
    final String nodeName = parseNodeName(args);
    final World world = World.start("kubernetes-cluster");
    NodeBootstrap.boot(world, new KubernetesClusterInstantiator(), Properties.instance, nodeName, false);
}
 
Example 4
Source File: TestWorld.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
public static TestWorld start(final String name) {
  final World world = World.start(name);
  return new TestWorld(world, name);
}
 
Example 5
Source File: TestWorld.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
public static synchronized TestWorld start(final String name, final java.util.Properties properties) {
  final World world = World.start(name, properties);
  return new TestWorld(world, name);
}
 
Example 6
Source File: TestWorld.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
public static TestWorld start(final String name, final Configuration configuration) {
  final World world = World.start(name, configuration);
  return new TestWorld(world, name);
}
 
Example 7
Source File: TestWorld.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
public static TestWorld start(final String name, final LoggerProvider loggerProvider) {
  return new TestWorld(World.start(name), name);
}
 
Example 8
Source File: TestWorld.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
public static synchronized TestWorld startWithDefaults(final String name) {
  return new TestWorld(World.start(name, Configuration.define()), name);
}
 
Example 9
Source File: DynamicResourceDispatcherTest.java    From vlingo-http with Mozilla Public License 2.0 3 votes vote down vote up
@Before
public void setUp() throws Exception {
  world = World.start("test-dynamic-resource-dispatcher");

  fluentResource = new FluentTestResource(world);

  final Resource<?> resource = fluentResource.routes();

  resource.allocateHandlerPool(world.stage());

  resources = Resources.are(resource);

  dispatcher = new TestDispatcher(resources, world.defaultLogger());
}