io.vlingo.actors.Configuration Java Examples

The following examples show how to use io.vlingo.actors.Configuration. 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: GridActorOfTest.java    From vlingo-lattice with Mozilla Public License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  Configuration configuration =
          Configuration
            .define()
            .with(Slf4jLoggerPlugin
                    .Slf4jLoggerPluginConfiguration
                    .define()
                    .defaultLogger()
                    .name("vlingo/actors"));

    testWorld = TestWorld.start("test", configuration);
    world = testWorld.world();

    final io.vlingo.cluster.model.Properties properties = ClusterProperties.oneNode();

    grid = Grid.start(world, properties, "node1");
    grid.quorumAchieved();
}
 
Example #2
Source File: PluginLoader.java    From vlingo-actors with Mozilla Public License 2.0 6 votes vote down vote up
private void loadPlugin(final Configuration configuration, final Properties properties, final String enabledPlugin) {
  final String pluginName = enabledPlugin.substring(pluginNamePrefix.length());
  final String classnameKey = "plugin." + pluginName + ".classname";
  final String classname = properties.getProperty(classnameKey);

  try {
    final Plugin maybePlugin = plugins.get(classname);
    if (maybePlugin == null) {
      final Class<?> pluginClass = Class.forName(classname);
      final Plugin plugin = (Plugin) pluginClass.newInstance();
      plugins.put(classname, plugin);
    }
  } catch (Exception e) {
    e.printStackTrace();
    throw new IllegalStateException("Cannot load plugin " + classname);
  }
}
 
Example #3
Source File: OrganizationEntityTest.java    From vlingo-examples with Mozilla Public License 2.0 6 votes vote down vote up
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setUp() throws Exception {
  grid = Grid.start("object-entity-test", Configuration.define(), ClusterProperties.oneNode(), "node1");
  grid.quorumAchieved();
  objectStore = grid.actorFor(ObjectStore.class, InMemoryObjectStoreActor.class, new MockDispatcher());
  registry = new ObjectTypeRegistry(grid.world());

  final Info<Organization> info =
          new Info(
          objectStore,
          io.vlingo.entity.object.State.class,
          "ObjectStore",
          MapQueryExpression.using(Organization.class, "find", MapQueryExpression.map("id", "id")),
          StateObjectMapper.with(Organization.class, new Object(), new Object()));

  registry.register(info);
}
 
Example #4
Source File: Slf4jLoggerPluginTest.java    From vlingo-actors with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testRegistration() {
  final Configuration configuration = Configuration.define();
  final Slf4jLoggerPlugin plugin = new Slf4jLoggerPlugin();
  plugin.configuration().buildWith(configuration, new PluginProperties("slf4jTestRegistration", new Properties()));

  plugin.start(registrar);

  assertTrue(registered);

  Logger logger = plugin.logger();

  assertNotNull(logger);
  assertEquals("slf4jTestRegistration", plugin.name());

  logger.debug("TEST:3 1");
  logger.debug("TEST:3 2");
  logger.debug("TEST:3 3");
}
 
Example #5
Source File: CommonSupervisorsPlugin.java    From vlingo-actors with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  for (final DefinitionValues values : DefinitionValues.allDefinitionValues(properties)) {
    final ConfiguredSupervisor supervisor =
            new ConfiguredSupervisor(
                    values.stageName,
                    values.name,
                    values.protocol,
                    values.supervisor);

    if (supervisors.contains(supervisor)) {
      supervisors.remove(supervisor);
    } 
    supervisors.add(supervisor);
  }
  configuration.with(this);
}
 
Example #6
Source File: DefaultSupervisorOverridePlugin.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  for (final DefinitionValues values : DefinitionValues.allDefinitionValues(properties)) {
    final ConfiguredSupervisor supervisor =
            new ConfiguredSupervisor(
                    values.stageName,
                    values.name,
                    values.supervisor);

    supervisors.add(supervisor);
  }
  configuration.with(this);
}
 
Example #7
Source File: PooledCompletesPlugin.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  this.name = properties.name;
  this.poolSize = properties.getInteger("pool", 10);
  this.mailbox = properties.getString("mailbox", null);
  configuration.with(this);
}
 
Example #8
Source File: PluginLoader.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
public Collection<Plugin> loadEnabledPlugins(final Configuration configuration, final Properties properties) {
  if (!properties.isEmpty()) {
    for (String enabledPlugin : findEnabledPlugins(properties)) {
      loadPlugin(configuration, properties, enabledPlugin);
    }
  }
  return plugins.values();
}
 
Example #9
Source File: ManyToOneConcurrentArrayQueuePlugin.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  this.name = properties.name;
  this.defaultMailbox = properties.getBoolean("defaultMailbox", false);
  this.dispatcherThrottlingCount = properties.getInteger("dispatcherThrottlingCount", 1);
  this.fixedBackoff = properties.getInteger("fixedBackoff", 2);
  this.notifyOnSend = properties.getBoolean("notifyOnSend", false);
  this.ringSize = properties.getInteger("size", 65535);
  this.sendRetires = properties.getInteger("sendRetires", 10);
  configuration.with(this);
}
 
Example #10
Source File: SharedRingBufferMailboxPlugin.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  this.name = properties.name;
  this.defaultMailbox = properties.getBoolean("defaultMailbox", false);
  this.dispatcherThrottlingCount = properties.getInteger("dispatcherThrottlingCount", 1);
  this.fixedBackoff = properties.getInteger("fixedBackoff", 2);
  this.notifyOnSend = properties.getBoolean("notifyOnSend", false);
  this.ringSize = properties.getInteger("size", 65535);
  configuration.with(this);
}
 
Example #11
Source File: ConcurrentQueueMailboxPlugin.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {
  this.name = properties.name;
  this.defaultMailbox = properties.getBoolean("defaultMailbox", true);
  this.dispatcherThrottlingCount = properties.getInteger("dispatcherThrottlingCount", 1);
  this.numberOfDispatchersFactor = properties.getFloat("numberOfDispatchersFactor", 1.5f);
  this.numberOfDispatchers = properties.getInteger("numberOfDispatchers", 0);
}
 
Example #12
Source File: CommonSupervisionTest.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Before
@Override
public void setUp() throws Exception {
  Configuration configuration =
          Configuration
            .define()
            .with(CommonSupervisorsPluginConfiguration
                    .define()
                    .supervisor("default", "pingSupervisor", Ping.class, PingSupervisorActor.class)
                    .supervisor("default", "pongSupervisor", Pong.class, PongSupervisorActor.class));

  testWorld = TestWorld.start("test", configuration);
  world = testWorld.world();
}
 
Example #13
Source File: OrganizationEntityTest.java    From vlingo-examples with Mozilla Public License 2.0 5 votes vote down vote up
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setUp() throws Exception {
  grid = Grid.start("stateful-entity-test", Configuration.define(), ClusterProperties.oneNode(), "node1");
  grid.quorumAchieved();
  stateStore = grid.actorFor(StateStore.class, InMemoryStateStoreActor.class, Arrays.asList(new MockDispatcher()));
  registry = new StatefulTypeRegistry(grid.world());

  final Info<Organization> info = new Info(stateStore, io.vlingo.entity.stateful.State.class, "StateStore");

  registry.register(info);
}
 
Example #14
Source File: OrganizationEntityTest.java    From vlingo-examples with Mozilla Public License 2.0 5 votes vote down vote up
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setUp() throws Exception {
  grid = Grid.start("sourced-entity-test", Configuration.define(), ClusterProperties.oneNode(), "node1");
  grid.quorumAchieved();
  journal = grid.actorFor(Journal.class, InMemoryJournalActor.class, new MockDispatcher());
  registry = new SourcedTypeRegistry(grid.world());

  final Info<Organization> info = new Info(journal, io.vlingo.entity.sourced.OrganizationEntity.class, "Journal");

  registry.register(info);
}
 
Example #15
Source File: DefaultSupervisorOverrideTest.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Before
@Override
public void setUp() throws Exception {
  Configuration configuration =
          Configuration
            .define()
            .with(DefaultSupervisorOverridePluginConfiguration
                    .define()
                    .supervisor("default", "overrideSupervisor", DefaultSupervisorOverride.class));

  testWorld = TestWorld.start("test", configuration);
  world = testWorld.world();
}
 
Example #16
Source File: ManyToOneConcurrentArrayQueuePlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
  configuration.with(ringSize(65535).dispatcherThrottlingCount(1).fixedBackoff(2).notifyOnSend(false).sendRetires(10));
}
 
Example #17
Source File: DefaultSupervisorOverridePlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
  configuration.with(supervisor("default", "overrideSupervisor", ConfiguredSupervisor.supervisorFrom("io.vlingo.actors.plugin.supervision.DefaultSupervisorOverride")));
}
 
Example #18
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 #19
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 #20
Source File: CommonSupervisorsPlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
}
 
Example #21
Source File: PooledCompletesPlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
  configuration.with(mailbox("queueMailbox").poolSize(10));
}
 
Example #22
Source File: SpaceTest.java    From vlingo-lattice with Mozilla Public License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  grid = Grid.start("test-world", Configuration.define(), ClusterProperties.oneNode(), "node1");
  grid.quorumAchieved();
}
 
Example #23
Source File: SharedRingBufferMailboxPlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
  configuration.with(ringSize(65535).fixedBackoff(2).notifyOnSend(false).dispatcherThrottlingCount(10));
}
 
Example #24
Source File: ConcurrentQueueMailboxPlugin.java    From vlingo-actors with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void build(final Configuration configuration) {
  configuration.with(defaultMailbox().numberOfDispatchersFactor(1.5f).dispatcherThrottlingCount(1));
}
 
Example #25
Source File: AccessorTest.java    From vlingo-lattice with Mozilla Public License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  grid = Grid.start("test-world", Configuration.define(), ClusterProperties.oneNode(), "node1");
  grid.quorumAchieved();
}
 
Example #26
Source File: DefaultMailboxProviderKeeperPluginConfiguration.java    From vlingo-actors with Mozilla Public License 2.0 2 votes vote down vote up
@Override
public void buildWith(final Configuration configuration, final PluginProperties properties) {

}
 
Example #27
Source File: DefaultMailboxProviderKeeperPluginConfiguration.java    From vlingo-actors with Mozilla Public License 2.0 2 votes vote down vote up
@Override
public void build(final Configuration configuration) {

}
 
Example #28
Source File: PluginConfiguration.java    From vlingo-actors with Mozilla Public License 2.0 votes vote down vote up
void buildWith(final Configuration configuration, final PluginProperties properties); 
Example #29
Source File: PluginConfiguration.java    From vlingo-actors with Mozilla Public License 2.0 votes vote down vote up
void build(final Configuration configuration);