Class GrpcUtils


  • public final class GrpcUtils
    extends Object
    Since:
    3.2
    Author:
    Oleg Zhurakousky
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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 GrpcSpringMessage toGrpcSpringMessage​(byte[] payload, Map<String,​String> headers)  
      static GrpcSpringMessage toGrpcSpringMessage​(org.springframework.messaging.Message<byte[]> message)  
    • Method Detail

      • 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 use biStreaming(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 name
        port - gRPC server port
        inputStream - 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 use clientStream(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 name
        port - gRPC server port
        inputStream - FluxMessage<byte[]>> representing input stream
        Returns:
        Message<byte[]> representing output