Java Code Examples for akka.actor.ActorSystem#create()
The following examples show how to use
akka.actor.ActorSystem#create() .
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: Kata3SearchAkkaStream.java From ditto-examples with Eclipse Public License 2.0 | 6 votes |
@Test public void part1CreateAkkaSearchQuery() { final ActorSystem system = ActorSystem.create("thing-search"); try { final String filter = "or(eq(attributes/counter,1), eq(attributes/counter,2))"; // TODO create Akka source of publisher with above filter final Source<List<Thing>, NotUsed> things = null; // Verify Results things.flatMapConcat(Source::from) .toMat(Sink.seq(), Keep.right()) .run(ActorMaterializer.create(system)) .thenAccept(t -> Assertions.assertThat(t).containsAnyOf(thing1, thing2).doesNotContain(thing3)) .toCompletableFuture() .join(); } finally { system.terminate(); } }
Example 2
Source File: Server1Main.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { // Override the configuration of the port // when specified as program argument System.setProperty("akka.remote.netty.tcp.port", "5557"); // Create an Akka system ActorSystem system = ActorSystem.create("ClusterSystem"); // Create an actor that handles cluster domain events ActorRef subscriber = system.actorOf(Props.create(Subscriber.class), "subscriptor"); }
Example 3
Source File: System.java From akka-java-examples with Apache License 2.0 | 5 votes |
public static void main(String... args) throws Exception { final ActorSystem actorSystem = ActorSystem.create("actor-server"); final ActorRef handler = actorSystem.actorOf(Props.create(EventHandler.class)); actorSystem.eventStream().subscribe(handler, Event.class); Thread.sleep(5000); final ActorRef actorRef = actorSystem.actorOf(Props.create(BaseProcessor.class), "eventsourcing-processor"); actorRef.tell(new Command("CMD 1"), null); actorRef.tell(new Command("CMD 2"), null); actorRef.tell(new Command("CMD 3"), null); actorRef.tell("snapshot", null); actorRef.tell(new Command("CMD 4"), null); actorRef.tell(new Command("CMD 5"), null); actorRef.tell("printstate", null); Thread.sleep(5000); log.debug("Actor System Shutdown Starting..."); actorSystem.shutdown(); }
Example 4
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "coffee-house"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name)); final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system); coffeeHouseApp.run(); }
Example 5
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "coffee-house"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name)); final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system); coffeeHouseApp.run(); }
Example 6
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "coffee-house"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name)); final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system); coffeeHouseApp.run(); }
Example 7
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "coffee-house"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name)); final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system); coffeeHouseApp.run(); }
Example 8
Source File: HttpPushFactoryTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Before public void createActorSystem() { actorSystem = ActorSystem.create(getClass().getSimpleName(), TestConstants.CONFIG); connectionConfig = DefaultConnectionConfig.of( DittoServiceConfig.of( DefaultScopedConfig.dittoScoped(TestConstants.CONFIG), "connectivity")); mat = ActorMaterializer.create(actorSystem); newBinding(); connection = createHttpPushConnection(binding); }
Example 9
Source File: AkkaActorITest.java From java-specialagent with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final ActorSystem system = ActorSystem.create(); testAsk(system); testTell(system); testForward(system); Await.result(system.terminate(), getDefaultDuration()); }
Example 10
Source File: AkkaStreamsDemo.java From reactive-streams-in-java with Apache License 2.0 | 5 votes |
public static List<Integer> doParallelSquares() { final ActorSystem system = ActorSystem.create("parallel-squares"); // 1 final Materializer mat = ActorMaterializer.create(system); // 2 List<Integer> squares = new ArrayList<>(); Source.range(1, 64) //2 .mapConcat(v -> Source.single(v).map(w -> w * w) //2 .runFold(asList(), (nil, x) -> asList(x), mat).toCompletableFuture().get()) .runForeach(x -> squares.add((int) x), mat); //3 try {Thread.sleep(300); } catch (Exception e) {} return squares; }
Example 11
Source File: ActorManager.java From nopol with GNU General Public License v2.0 | 5 votes |
public static void createActorSystem(ClassLoader classLoader) { akkaConfig = ConfigFactory.load(classLoader, "common"); actorSystemNopol = akkaConfig.getString("nopol.system.name"); addressNopol = akkaConfig.getString("nopol.akka.remote.netty.tcp.hostname"); portNopol = akkaConfig.getString("nopol.akka.remote.netty.tcp.port"); nameActorNopol = akkaConfig.getString("nopol.actor.name"); system = ActorSystem.create("PluginActorSystem", akkaConfig, classLoader); buildRemoteActor("127.0.0.1", "2553"); }
Example 12
Source File: DefaultMessageMapperFactoryTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@BeforeClass public static void initTestFixture() { final Config testConfig = ConfigFactory.parseMap( Collections.singletonMap("ditto.connectivity.mapping.dummy", "")); mappingConfig = DefaultMappingConfig.of(testConfig.getConfig("ditto.connectivity")); system = ActorSystem.create("test", testConfig); }
Example 13
Source File: Application.java From reactive-streams-in-java with Apache License 2.0 | 4 votes |
@Bean ActorSystem createActorSystem() { return ActorSystem.create(); }
Example 14
Source File: Mqtt5ValidatorTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@BeforeClass public static void setUp() { actorSystem = ActorSystem.create("AkkaTestSystem", TestConstants.CONFIG); }
Example 15
Source File: ErrorHandlingActorTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@BeforeClass public static void setUp() { actorSystem = ActorSystem.create("AkkaTestSystem", TestConstants.CONFIG); pubSubMediator = DistributedPubSub.get(actorSystem).mediator(); conciergeForwarder = actorSystem.actorOf(TestConstants.ConciergeForwarderActorMock.props()); }
Example 16
Source File: JmsConnectionHandlingActorTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@BeforeClass public static void setUp() { actorSystem = ActorSystem.create("AkkaTestSystem", TestConstants.CONFIG); connection = TestConstants.createConnection(connectionId); }
Example 17
Source File: Application.java From java-11-examples with Apache License 2.0 | 4 votes |
public static void main(String[] args) { Arguments arguments = new Arguments(); JCommander.newBuilder() .addObject(arguments) .build() .parse(args); LOG.info("Application start ..."); if (arguments.getConfigPath().isEmpty()) { LOG.error("Error: expected first parameter /path/to/akka.conf file"); System.exit(1); } File akkaConfigFile = new File(arguments.getConfigPath()); if (!akkaConfigFile.exists()) { LOG.error("Error: config file not found {}", arguments.getConfigPath()); System.exit(1); } LOG.info("akkaConfigPath = {}", arguments.getConfigPath()); Config config = ConfigFactory.parseFile(akkaConfigFile); ActorSystem actorSystem = ActorSystem.create(Utils.CLUSTER_NAME, config); AkkaManagement management = AkkaManagement.get(actorSystem); management.start(); if (Arguments.CLUSTER_TYPE_DYNAMIC.equals(arguments.getClusterType())) { LOG.info("starting dynamic cluster ..."); ClusterBootstrap clusterBootstrap = ClusterBootstrap.get(actorSystem); clusterBootstrap.start(); } else { LOG.info("starting static cluster ..."); } SshSessionFactory sshSessionFactory = new SshSessionFactoryImpl(); Application application = new Application(actorSystem, sshSessionFactory); application.init(); Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { LOG.info("shutting down ..."); management.stop(); application.destroy(); actorSystem.terminate(); LOG.info("bye."); } } ); LOG.info("started."); }
Example 18
Source File: DockerSwarmPlugin.java From docker-swarm-plugin with MIT License | 4 votes |
@Override public void start() throws Exception { this.actorSystem = ActorSystem.create("swarm-plugin", ConfigFactory.load()); }
Example 19
Source File: BackgroundSyncStreamTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@BeforeClass public static void init() { actorSystem = ActorSystem.create(); materializer = ActorMaterializer.create(actorSystem); }
Example 20
Source File: MessageAggregatorTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@Before public void start() { actorSystem = ActorSystem.create(); }