-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcessDesignGrpcService.java
25 lines (20 loc) · 1.08 KB
/
ProcessDesignGrpcService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.acme.apidomains.process_design.handlers;
import com.acme.apidomains.interceptors.LogGrpcInterceptor;
import com.acme.apidomains.process_design.mappers.SkillMapper;
import com.acme.apidomains.process_design.services.SkillService;
import com.acme.domains.process_design.QueryServiceGrpc;
import com.acme.domains.process_design.transport.ListSkills;
import io.grpc.stub.StreamObserver;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.lognet.springboot.grpc.GRpcService;
@GRpcService(interceptors = {LogGrpcInterceptor.class})
@Slf4j
@RequiredArgsConstructor
public class ProcessDesignGrpcService extends QueryServiceGrpc.QueryServiceImplBase {
private final SkillService skillService;
public void listSkills(ListSkills.ListSkillsRequest request, StreamObserver<ListSkills.ListSkillsResponse> responseObserver) {
skillService.findAllSkills().map(SkillMapper::toGrpc).collectList().map(SkillMapper::toGrpcResponse)
.subscribe(responseObserver::onNext, responseObserver::onError, responseObserver::onCompleted);
}
}