use of org.apache.eventmesh.runtime.core.protocol.grpc.processor.RequestMessageProcessor in project incubator-eventmesh by apache.
the class ProducerService method requestReply.
public void requestReply(SimpleMessage request, StreamObserver<SimpleMessage> responseObserver) {
cmdLogger.info("cmd={}|{}|client2eventMesh|from={}|to={}", "RequestReply", EventMeshConstants.PROTOCOL_GRPC, request.getHeader().getIp(), eventMeshGrpcServer.getEventMeshGrpcConfiguration().eventMeshIp);
EventEmitter<SimpleMessage> emitter = new EventEmitter<>(responseObserver);
threadPoolExecutor.submit(() -> {
RequestMessageProcessor requestMessageProcessor = new RequestMessageProcessor(eventMeshGrpcServer);
try {
requestMessageProcessor.process(request, emitter);
} catch (Exception e) {
logger.error("Error code {}, error message {}", StatusCode.EVENTMESH_REQUEST_REPLY_MSG_ERR.getRetCode(), StatusCode.EVENTMESH_REQUEST_REPLY_MSG_ERR.getErrMsg(), e);
ServiceUtils.sendStreamRespAndDone(request.getHeader(), StatusCode.EVENTMESH_REQUEST_REPLY_MSG_ERR, e.getMessage(), emitter);
}
});
}
Aggregations