Java Code Examples for akka.actor.ActorSystem#dispatcher()
The following examples show how to use
akka.actor.ActorSystem#dispatcher() .
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: UnitTest.java From deployment-examples with MIT License | 6 votes |
@Test public void testAsync() { final ActorSystem actorSystem = ActorSystem.create("test"); try { final ExecutionContextExecutor ec = actorSystem.dispatcher(); final AsyncController controller = new AsyncController(actorSystem, ec); final CompletionStage<Result> future = controller.message(); // Block until the result is completed await().until(() -> { assertThat(future.toCompletableFuture()).isCompletedWithValueMatching(result -> { return contentAsString(result).equals("Hi!"); }); }); } finally { actorSystem.terminate(); } }
Example 2
Source File: SandalphonThreadsScheduler.java From judgels with GNU General Public License v2.0 | 5 votes |
@Inject public SandalphonThreadsScheduler(ActorSystem actorSystem, SandalphonConfiguration config, ProgrammingSubmissionService programmingSubmissionService, @Named("sealtiel") BasicAuthHeader sealtielClientAuthHeader, MessageService messageService) { Scheduler scheduler = actorSystem.scheduler(); ExecutionContextExecutor context = actorSystem.dispatcher(); GradingResponsePoller poller = new GradingResponsePoller(scheduler, context, programmingSubmissionService, sealtielClientAuthHeader, messageService, TimeUnit.MILLISECONDS.convert(2, TimeUnit.SECONDS)); if (config.getSealtielConfig().isPresent()) { scheduler.schedule(Duration.create(1, TimeUnit.SECONDS), Duration.create(3, TimeUnit.SECONDS), poller, context); } }
Example 3
Source File: CassandraSession.java From ts-reaktive with MIT License | 4 votes |
public CassandraSession(ActorSystem system, String metricsCategory, Function<Session,CompletionStage<Done>> init) { this.delegate = new akka.persistence.cassandra.session.javadsl.CassandraSession(system, new ConfigSessionProvider(system, system.settings().config().getConfig("cassandra-journal")), new CassandraSessionSettings(system.settings().config().getConfig("cassandra-journal")), system.dispatcher(), system.log(), metricsCategory, init); }
Example 4
Source File: CompressedDDataHandler.java From ditto with Eclipse Public License 2.0 | 3 votes |
/** * Start distributed-data replicator for compressed topics under an actor system's user guardian using the default * dispatcher. * * @param system the actor system. * @param ddataConfig the distributed data config. * @param topicType the type of messages, typically the canonical name of the message class. * @param pubSubConfig the pub-sub config. * @return access to the distributed data. */ public static CompressedDDataHandler create(final ActorSystem system, final DistributedDataConfig ddataConfig, final String topicType, final PubSubConfig pubSubConfig) { final List<Integer> seeds = Hashes.digestStringsToIntegers(pubSubConfig.getSeed(), pubSubConfig.getHashFamilySize()); return new CompressedDDataHandler(ddataConfig, system, system, system.dispatcher(), topicType, seeds); }