Java Code Examples for akka.actor.Props#create()

The following examples show how to use akka.actor.Props#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: DefaultPersistenceStreamingActor.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
static <T extends EntityIdWithRevision> Props propsForTests(final Class<T> elementClass,
        final Function<PidWithSeqNr, T> entityMapper,
        final Function<EntityIdWithRevision, PidWithSeqNr> entityUnmapper,
        final MongoReadJournal readJournal) {

    return Props.create(DefaultPersistenceStreamingActor.class, elementClass, entityMapper, entityUnmapper,
            readJournal);
}
 
Example 2
Source File: CoffeeHouseApp.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
private static Props printerProps(ActorRef coffeeHouse) {
    return Props.create(AbstractLoggingActor.class, () -> {
        return new AbstractLoggingActor() {
            @Override
            public Receive createReceive() {
                return receiveBuilder().matchAny(o -> log().info(o.toString())).build();
            }

            {
                coffeeHouse.tell("Brew Coffee", self());
            }
        };
    });
}
 
Example 3
Source File: BadgeIssuerActorTest.java    From sunbird-lms-service with MIT License 5 votes vote down vote up
@Before
public void setUp() {
  system = ActorSystem.create("system");
  probe = new TestKit(system);
  mockBadgingService = PowerMockito.mock(BadgrServiceImpl.class);
  props = Props.create(BadgeIssuerActor.class, mockBadgingService);
  subject = system.actorOf(props);
  actorMessage = new Request();
  ResponseCode error = ResponseCode.resourceNotFound;
  resourceNotFoundException =
      new ProjectCommonException(
          error.getErrorCode(), error.getErrorMessage(), error.getResponseCode());
}
 
Example 4
Source File: CoffeeHouseApp.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
private static Props printerProps(ActorRef coffeeHouse) {
    return Props.create(AbstractLoggingActor.class, () -> new AbstractLoggingActor() {
        @Override
        public Receive createReceive() {
            return receiveBuilder().matchAny(o -> log().info(o.toString())).build();
        }

        {
            coffeeHouse.tell("Brew Coffee", self());
        }
    });
}
 
Example 5
Source File: TransactionInterceptionTest.java    From servicecomb-pack with Apache License 2.0 5 votes vote down vote up
static Props props(final TransactionalUserService userService) {
  return Props.create(UserServiceActor.class, new Creator<UserServiceActor>() {
    @Override
    public UserServiceActor create() throws Exception {
      return new UserServiceActor(userService);
    }
  });
}
 
Example 6
Source File: CoffeeHouseApp.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
private static Props printerProps(ActorRef coffeeHouse) {
    return Props.create(AbstractLoggingActor.class, () -> {
        return new AbstractLoggingActor() {
            @Override
            public Receive createReceive() {
                return receiveBuilder().matchAny(o -> log().info(o.toString())).build();
            }

            {
                coffeeHouse.tell("Brew Coffee", self());
            }
        };
    });
}
 
Example 7
Source File: QuarantineMonitorTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
static Props getQuarantineMonitorProps(QuarantineHandler handler) {
	return Props.create(QuarantineMonitor.class, handler, LOG);
}
 
Example 8
Source File: Master.java    From akka-tutorial with Apache License 2.0 4 votes vote down vote up
public static Props props(final ActorRef reader, final ActorRef collector) {
	return Props.create(Master.class, () -> new Master(reader, collector));
}
 
Example 9
Source File: AkkaSpringExtension.java    From odata with Apache License 2.0 4 votes vote down vote up
public Props props(String actor) {
    return Props.create(AkkaSpringActorProducer.class, applicationContext, actor);
}
 
Example 10
Source File: Guest.java    From oreilly-reactive-architecture-student with Apache License 2.0 4 votes vote down vote up
public static Props props(final ActorRef waiter, final Coffee favoriteCoffee,
                          final FiniteDuration finishCoffeeDuration, final int caffeineLimit) {
    return Props.create(Guest.class,
            () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration, caffeineLimit));
}
 
Example 11
Source File: LargeMessageProxy.java    From akka-tutorial with Apache License 2.0 4 votes vote down vote up
public static Props props() {
	return Props.create(LargeMessageProxy.class);
}
 
Example 12
Source File: CoffeeHouse.java    From oreilly-reactive-architecture-student with Apache License 2.0 4 votes vote down vote up
public static Props props() {
    return Props.create(CoffeeHouse.class, CoffeeHouse::new);
}
 
Example 13
Source File: DevOpsCommandsActor.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @return the Akka configuration Props object.
 */
static Props props(final ActorRef devOpsCommandSender, final DevOpsCommand<?> devOpsCommand) {
    return Props.create(DevOpsCommandResponseCorrelationActor.class, devOpsCommandSender, devOpsCommand);
}
 
Example 14
Source File: RabbitMQClientActor.java    From ditto with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Creates Akka configuration object for this actor.
 *
 * @param connection the connection.
 * @param conciergeForwarder the actor used to send signals to the concierge service.
 * @param connectionActor the connectionPersistenceActor which created this client.
 * @param rabbitConnectionFactoryFactory the ConnectionFactory Factory to use.
 * @return the Akka configuration Props object.
 */
static Props propsForTests(final Connection connection, @Nullable final ActorRef conciergeForwarder,
        final ActorRef connectionActor, final RabbitConnectionFactoryFactory rabbitConnectionFactoryFactory) {

    return Props.create(RabbitMQClientActor.class, validateConnection(connection), rabbitConnectionFactoryFactory,
            conciergeForwarder, connectionActor);
}
 
Example 15
Source File: EnforcerActor.java    From ditto with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Creates Akka configuration object Props for this enforcer actor.
 *
 * @param pubSubMediator Akka pub sub mediator.
 * @param enforcementProviders a set of {@link EnforcementProvider}s.
 * @param conciergeForwarder an actorRef to concierge forwarder.
 * @param preEnforcer a function executed before actual enforcement, may be {@code null}.
 * @param thingIdCache the cache for Thing IDs to either ACL or Policy ID.
 * @param aclEnforcerCache the ACL cache.
 * @param policyEnforcerCache the Policy cache.
 * @return the Akka configuration Props object.
 */
public static Props props(final ActorRef pubSubMediator,
        final Set<EnforcementProvider<?>> enforcementProviders,
        final ActorRef conciergeForwarder,
        @Nullable final PreEnforcer preEnforcer,
        @Nullable final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache,
        @Nullable final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache,
        @Nullable final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache) {

    return Props.create(EnforcerActor.class, pubSubMediator, enforcementProviders, conciergeForwarder, preEnforcer,
            thingIdCache, aclEnforcerCache, policyEnforcerCache);
}
 
Example 16
Source File: SpringExtension.java    From akka-java-springfactory with MIT License 2 votes vote down vote up
/**
 * Create a Props for the specified actorBeanName using the
 * SpringActorProducer class.
 *
 * @param actorBeanName The name of the actor bean to create Props for
 * @param requiredType  Type of the actor bean must match. Can be an interface or superclass
 *                      of the actual class, or {@code null} for any match. For example, if the value
 *                      is {@code Object.class}, this method will succeed whatever the class of the
 *                      returned instance.
 * @return a Props that will create the actor bean using Spring
 */
public Props create(String actorBeanName, Class<? extends AbstractActor> requiredType) {
    return Props.create(SpringActorProducer.class,
            applicationContext, actorBeanName, requiredType);
}
 
Example 17
Source File: CompositeCachingHealthCheckingActor.java    From ditto with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates Akka configuration object Props for this {@link CompositeCachingHealthCheckingActor}.
 *
 * @param childActorProps the Props for creating child actors, each providing health for a different subsystem.
 * @param updateInterval the duration between the updates of the health (sub systems will be queried for their
 * health in this interval).
 * @param enabled whether the health-check should be enabled.
 * @return the Akka configuration Props object
 */
public static Props props(final Map<String, Props> childActorProps, final Duration updateInterval,
        final boolean enabled) {

    return Props.create(CompositeCachingHealthCheckingActor.class, childActorProps, updateInterval, enabled);
}
 
Example 18
Source File: AmqpClientActor.java    From ditto with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates Akka configuration object for this actor.
 *
 * @param connection the connection.
 * @param conciergeForwarder the actor used to send signals to the concierge service.
 * @param connectionActor the connectionPersistenceActor which created this client.
 * @return the Akka configuration Props object.
 */
public static Props props(final Connection connection, @Nullable final ActorRef conciergeForwarder,
        final ActorRef connectionActor) {

    return Props.create(AmqpClientActor.class, validateConnection(connection), conciergeForwarder, connectionActor);
}
 
Example 19
Source File: HiveMqtt5ConsumerActor.java    From ditto with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates Akka configuration object for this actor.
 *
 * @param connectionId ID of the connection this consumer is belongs to
 * @param messageMappingProcessor the ActorRef to the {@code MessageMappingProcessor}
 * @param source the source from which this consumer is built
 * @param dryRun whether this is a dry-run/connection test or not
 * @return the Akka configuration Props object.
 */
static Props props(final ConnectionId connectionId, final ActorRef messageMappingProcessor,
        final Source source, final boolean dryRun) {
    return Props.create(HiveMqtt5ConsumerActor.class, connectionId, messageMappingProcessor,
            source, dryRun);
}
 
Example 20
Source File: MongoHealthChecker.java    From ditto with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates Akka configuration object Props for this MongoClientActor.
 *
 * @return the Akka configuration Props object
 * @throws NullPointerException if {@code mongoDbConfig} is {@code null}.
 */
public static Props props() {
    return Props.create(MongoHealthChecker.class);
}