use of io.spine.server.stand.Stand in project core-java by SpineEventEngine.
the class QueryServiceShould method dispatch_queries_to_proper_bounded_context.
@Test
public void dispatch_queries_to_proper_bounded_context() {
final Query query = Given.AQuery.readAllProjects();
final Stand stand = projectsContext.getStand();
service.read(query, responseObserver);
checkOkResponse(responseObserver);
verify(stand).execute(query, responseObserver);
verify(customersContext.getStand(), never()).execute(query, responseObserver);
}
use of io.spine.server.stand.Stand in project core-java by SpineEventEngine.
the class QueryService method read.
@SuppressWarnings("MethodDoesntCallSuperMethod")
// as we override default implementation with `unimplemented` status.
@Override
public void read(Query query, StreamObserver<QueryResponse> responseObserver) {
log().debug("Incoming query: {}", query);
final TypeUrl type = Queries.typeOf(query);
final BoundedContext boundedContext = typeToContextMap.get(type);
final Stand stand = boundedContext.getStand();
try {
stand.execute(query, responseObserver);
} catch (@SuppressWarnings("OverlyBroadCatchBlock") Exception e) {
log().error("Error processing query", e);
responseObserver.onError(e);
}
}
use of io.spine.server.stand.Stand in project core-java by SpineEventEngine.
the class SubscriptionService method cancel.
@Override
public void cancel(Subscription subscription, StreamObserver<Response> responseObserver) {
log().debug("Incoming cancel request for the subscription topic: {}", subscription);
final BoundedContext boundedContext = selectBoundedContext(subscription);
try {
final Stand stand = boundedContext.getStand();
stand.cancel(subscription, responseObserver);
} catch (@SuppressWarnings("OverlyBroadCatchBlock") Exception e) {
log().error("Error processing cancel subscription request", e);
responseObserver.onError(e);
}
}
use of io.spine.server.stand.Stand in project core-java by SpineEventEngine.
the class SubscriptionService method subscribe.
@Override
public void subscribe(Topic topic, StreamObserver<Subscription> responseObserver) {
log().debug("Creating the subscription to a topic: {}", topic);
try {
final Target target = topic.getTarget();
final BoundedContext boundedContext = selectBoundedContext(target);
final Stand stand = boundedContext.getStand();
stand.subscribe(topic, responseObserver);
} catch (@SuppressWarnings("OverlyBroadCatchBlock") Exception e) {
log().error("Error processing subscription request", e);
responseObserver.onError(e);
}
}
use of io.spine.server.stand.Stand in project core-java by SpineEventEngine.
the class SubscriptionServiceShould method setupBoundedContextWithProjectAggregateRepo.
private static BoundedContext setupBoundedContextWithProjectAggregateRepo() {
final BoundedContext boundedContext = BoundedContext.newBuilder().setStand(Stand.newBuilder()).build();
final Stand stand = boundedContext.getStand();
stand.registerTypeSupplier(new Given.ProjectAggregateRepository());
return boundedContext;
}
Aggregations