Class GrpcUtils
java.lang.Object
org.springframework.cloud.function.grpc.GrpcUtils
- Since:
- 3.2
- Author:
- Oleg Zhurakousky
-
Method Summary
Modifier and TypeMethodDescriptionstatic reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> biStreaming(String host, int port, reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support bi-directional streaming interaction.static reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> biStreaming(reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support bi-directional streaming interaction.static org.springframework.messaging.Message<byte[]> clientStream(String host, int port, reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support client-side streaming interaction.static org.springframework.messaging.Message<byte[]> clientStream(reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support client-side streaming interaction.static org.springframework.messaging.Message<byte[]> fromGrpcSpringMessage(GrpcSpringMessage message) static org.springframework.messaging.Message<byte[]> requestReply(String host, int port, org.springframework.messaging.Message<byte[]> inputMessage) static org.springframework.messaging.Message<byte[]> requestReply(org.springframework.messaging.Message<byte[]> inputMessage) static reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> serverStream(String host, int port, org.springframework.messaging.Message<byte[]> inputMessage) static GrpcSpringMessagetoGrpcSpringMessage(byte[] payload, Map<String, String> headers) static GrpcSpringMessagetoGrpcSpringMessage(org.springframework.messaging.Message<byte[]> message)
-
Method Details
-
toGrpcSpringMessage
-
toGrpcSpringMessage
public static GrpcSpringMessage toGrpcSpringMessage(org.springframework.messaging.Message<byte[]> message) -
fromGrpcSpringMessage
public static org.springframework.messaging.Message<byte[]> fromGrpcSpringMessage(GrpcSpringMessage message) -
requestReply
public static org.springframework.messaging.Message<byte[]> requestReply(org.springframework.messaging.Message<byte[]> inputMessage) -
requestReply
public static org.springframework.messaging.Message<byte[]> requestReply(String host, int port, org.springframework.messaging.Message<byte[]> inputMessage) -
biStreaming
public static reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> biStreaming(reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support bi-directional streaming interaction. Will connect to gRPC server using default host/port, otherwise usebiStreaming(String, int, Flux)method. Keep in mind that there is no implied relationship between input stream and output stream. They are completely independent where one may end before the other.- Parameters:
inputStream-FluxMessage<byte[]>>representing input stream.- Returns:
Flux<Message<byte[]>>representing output stream
-
biStreaming
public static reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> biStreaming(String host, int port, reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support bi-directional streaming interaction. Keep in mind that there is no implied relationship between input stream and output stream. They are completely independent where one may end before the other.- Parameters:
host- gRPC server host nameport- gRPC server portinputStream-FluxMessage<byte[]>>representing input stream- Returns:
Flux<Message<byte[]>>representing output stream
-
serverStream
public static reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> serverStream(String host, int port, org.springframework.messaging.Message<byte[]> inputMessage) -
clientStream
public static org.springframework.messaging.Message<byte[]> clientStream(reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support client-side streaming interaction. Will connect to gRPC server using default host/port, otherwise useclientStream(String, int, Flux)method.- Parameters:
inputStream-FluxMessage<byte[]>>representing input stream.- Returns:
Message<byte[]>representing output
-
clientStream
public static org.springframework.messaging.Message<byte[]> clientStream(String host, int port, reactor.core.publisher.Flux<org.springframework.messaging.Message<byte[]>> inputStream) Utility method to support client-side streaming interaction.- Parameters:
host- gRPC server host nameport- gRPC server portinputStream-FluxMessage<byte[]>>representing input stream- Returns:
Message<byte[]>representing output
-