Package akka.actor

Examples of akka.actor.Props


import com.typesafe.config.ConfigFactory;

public class BettingServiceApplication {
    public static void main(String[] args) {
        ActorSystem system = ActorSystem.create("BettingServiceActorSystem", ConfigFactory.load());
        system.actorOf(new Props(BettingService.class), "bettingService");
    }
View Full Code Here


   * @param processInstanceCleansingActorName the process instance cleansing actor name
   */
  public CoreActors(ActorSystem actorSystem, String metaDataActorName, int instances, String processInstanceCleansingActorName) {
    this.actorSystem = actorSystem;
    this.metaDataActor = this.actorSystem.actorOf(
        new Props(MetaDataService.class).withRouter(
            new SmallestMailboxRouter(instances))
            .withDispatcher("file-mailbox-dispatcher"),
            metaDataActorName);
    this.processInstanceCleansingActor = this.actorSystem.actorOf(
        new Props(ProcessInstanceCleansingService.class).withRouter(
            new SmallestMailboxRouter(instances))
            .withDispatcher("file-mailbox-dispatcher"),
            processInstanceCleansingActorName);
  }
View Full Code Here

  private ActorRef createNodeServiceActor(String clientId,
      TProcess processJaxb, ArrayList<TSubProcess> subProcessesJaxb, TFlowNode flowNodeJaxb,
       List<TSequenceFlow> sequenceFlowsJaxb) {
   
    // create flow node actors (a bridge factory is used to be able to pass parameters to the UntypedActorFactory)
    ActorRef nodeServiceActor = this.actorSystem.actorOf(new Props(
        new ServiceNodeBridge(clientId, processJaxb, subProcessesJaxb, flowNodeJaxb, sequenceFlowsJaxb)
          ).withDispatcher("file-mailbox-dispatcher"), ActorReferenceService.getActorReferenceString(
            IdService.getUniqueFlowNodeId(clientId, processJaxb, subProcessesJaxb, flowNodeJaxb)));
   
    LOG.debug(String.format("%s --> resulting akka object: %s", flowNodeJaxb,
View Full Code Here

  }

  @Override
  protected void activate(ActivationMessage message) {

    ActorRef serviceTaskInstance = this.getContext().actorOf(new Props(
        new UntypedActorFactory() {
          private static final long serialVersionUID = 1L;

          // create an instance of a (synchronous) service worker
          public UntypedActor create() {
View Full Code Here

   * @param context the context
   * @param eventDefinitionParameter the event definition parameter
   * @return the ActorRef of the EventDefinition
   */
  public static ActorRef createEventDefinitionActor(String uniqueFlowNodeId, UntypedActorContext context, final EventDefinitionParameter eventDefinitionParameter) {
    ActorRef eventDefinitionActor = context.actorOf(new Props(new UntypedActorFactory() {
      private static final long serialVersionUID = 1L;

      public UntypedActor create() {
          return new EventDefinitionFactory().getEventDefinition(eventDefinitionParameter);
        }
View Full Code Here

    this.newValues = new ArrayList();
    for(int i = 0; i < data.size() ; i++) {
      newValues.add(new Object());
    }
    routerActor = this.getContext().actorOf(
      new Props(ActorLevel2.class)
      .withRouter(new RoundRobinRouter(nrOfWorkers)), "roundRobinRouterActor");
  }
View Full Code Here

    return ep;
  }
 
  public void initialize() {
    system = ActorSystem.create("fuzzy-avenger-" + System.currentTimeMillis());
    shutdownCommandListener = system.actorOf(new Props(ActorLevel0_SystemShutdowner.class), "shutdownCommandListener");
  }
View Full Code Here

  }
 
  @SuppressWarnings({ "unchecked" })
  public List<Object> run(final List<Object> data, List<Object> parameters, Function<?, ?> functionToApply, final int numberOfWorkers, int numberOfSecondsTimeout) {
    final ImmutableList iData = ImmutableList.builder().addAll(data).build();
    ActorRef actorLevel1 = system.actorOf(new Props(new UntypedActorFactory() {
      private static final long serialVersionUID = 1L;
      public UntypedActor create() {
        return new ActorLevel1(iData, numberOfWorkers);
      }
    }), "ActorLevel1-" + System.currentTimeMillis());
View Full Code Here

  }
 
  @Test
  public void demonstrateDispatcher() {
    //#dispatchers
    Props props =
      // “head” router actor will run on "router-dispatcher" dispatcher
      // Worker routees will run on "pool-dispatcher" dispatcher 
      new RandomPool(5).withDispatcher("router-dispatcher").props(
        Props.create(Worker.class));
    ActorRef router = system.actorOf(props, "poolWithDispatcher");
View Full Code Here

  }

  @Test
  public void creatingPropsConfig() {
    //#creating-props
    Props props1 = Props.create(MyActor.class);
    Props props2 = Props.create(ActorWithArgs.class,
      () -> new ActorWithArgs("arg")); // careful, see below
    Props props3 = Props.create(ActorWithArgs.class, "arg");
    //#creating-props

    //#creating-props-deprecated
    // NOT RECOMMENDED within another actor:
    // encourages to close over enclosing class
    Props props7 = Props.create(ActorWithArgs.class,
      () -> new ActorWithArgs("arg"));
    //#creating-props-deprecated
  }
View Full Code Here

TOP

Related Classes of akka.actor.Props

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.