Example #1
0
  private static UserDataServiceClient createUserDataServiceClientProxy(
      final ServiceBundle serviceBundle, final int numWorkers) {
    final ServiceWorkers userDataServiceWorkers = workers();

    for (int index = 0; index < numWorkers; index++) {
      ServiceQueue userDataService =
          serviceBuilder().setServiceObject(new UserDataService()).build();
      userDataService.startCallBackHandler();
      userDataServiceWorkers.addService(userDataService);
    }

    userDataServiceWorkers.start();

    serviceBundle.addServiceConsumer("workers", userDataServiceWorkers);

    return serviceBundle.createLocalProxy(UserDataServiceClient.class, "workers");
  }
Example #2
0
  private static RecommendationServiceClient createRecommendationServiceClientProxy(
      final ServiceBundle serviceBundle,
      final UserDataServiceClient userDataServiceClient,
      int numWorkers) {

    final ServiceWorkers recommendationShardedWorkers = shardOnFirstArgumentWorkers();

    for (int index = 0; index < numWorkers; index++) {
      RecommendationService recommendationServiceImpl =
          new RecommendationService(userDataServiceClient);

      ServiceQueue serviceQueue =
          serviceBuilder().setServiceObject(recommendationServiceImpl).build();
      serviceQueue.startCallBackHandler();
      recommendationShardedWorkers.addService(serviceQueue);
    }

    recommendationShardedWorkers.start();

    serviceBundle.addServiceConsumer("recomendation", recommendationShardedWorkers);

    return serviceBundle.createLocalProxy(RecommendationServiceClient.class, "recomendation");
  }