Interface ServiceClient

All Superinterfaces:
AutoCloseable

public interface ServiceClient extends AutoCloseable
Generic interface for a client that communicates with a remote service. Can point to a real remote service or to a mock for testing purposes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    <REQ, RESP> RESP
    invoke(ServiceClient.Method method, REQ request, Class<RESP> responseClass)
    Invokes the specified method on the remote microservice (or on its substitution) with the given request.
    <REQ, RESP> CompletableFuture<RESP>
    invokeAsync(ServiceClient.Method method, REQ request, Class<RESP> responseClass)
    Asynchronously invokes the specified method on the remote microservice.
  • Method Details

    • invoke

      <REQ, RESP> RESP invoke(ServiceClient.Method method, REQ request, Class<RESP> responseClass) throws SchemaException
      Invokes the specified method on the remote microservice (or on its substitution) with the given request.
      Throws:
      SchemaException
    • invokeAsync

      <REQ, RESP> CompletableFuture<RESP> invokeAsync(ServiceClient.Method method, REQ request, Class<RESP> responseClass)
      Asynchronously invokes the specified method on the remote microservice. Returns a CompletableFuture that will complete with the response or exceptionally with SchemaException.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable