io.vertx.serviceproxy

## Class ServiceBinder

- java.lang.Object
- - io.vertx.serviceproxy.ServiceBinder

-     public class ServiceBinder
      extends Object

  A binder for Service Proxies which state can be reused during the binder lifecycle.
  Author:
    Paulo Lopes

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `DEFAULT_CONNECTION_TIMEOUT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceBinder(Vertx vertx)` Creates a factory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ServiceBinder` | `addInterceptor(java.util.function.Function<Message<JsonObject>,Future<Message<JsonObject>>> interceptor)`
    `<T> MessageConsumer<JsonObject>` | `register(Class<T> clazz, T service)` Registers a service on the event bus.
    `<T> MessageConsumer<JsonObject>` | `registerLocal(Class<T> clazz, T service)` Registers a local service on the event bus.
    `ServiceBinder` | `setAddress(String address)` Set the address to use on the subsequent proxy creations or service registrations.
    `ServiceBinder` | `setIncludeDebugInfo(boolean includeDebugInfo)` When an exception is thrown by the service or the underlying handler, include debugging info in the ServiceException, that you can access with `ServiceException.getDebugInfo()`
    `ServiceBinder` | `setTimeoutSeconds(long timeoutSeconds)` Set the default timeout in seconds while waiting for a reply.
    `ServiceBinder` | `setTopLevel(boolean topLevel)` Set if the services to create are a top level services.
    `void` | `unregister(MessageConsumer<JsonObject> consumer)` Unregisters a published service.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_CONNECTION_TIMEOUT

          public static final long DEFAULT_CONNECTION_TIMEOUT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ServiceBinder

          public ServiceBinder(Vertx vertx)

      Creates a factory.
      Parameters:
        `vertx` - a non null instance of vertx.

  - ### Method Detail

    - #### setAddress

          public ServiceBinder setAddress(String address)

      Set the address to use on the subsequent proxy creations or service registrations.
      Parameters:
        `address` - an eventbus address
      Returns:
        self

    - #### setTopLevel

          public ServiceBinder setTopLevel(boolean topLevel)

      Set if the services to create are a top level services.
      Parameters:
        `topLevel` - true for top level (default: true)
      Returns:
        self

    - #### setTimeoutSeconds

          public ServiceBinder setTimeoutSeconds(long timeoutSeconds)

      Set the default timeout in seconds while waiting for a reply.
      Parameters:
        `timeoutSeconds` - the default timeout (default: 5 minutes)
      Returns:
        self

    - #### setIncludeDebugInfo

          public ServiceBinder setIncludeDebugInfo(boolean includeDebugInfo)

      When an exception is thrown by the service or the underlying handler, include debugging info in the ServiceException, that you can access with `ServiceException.getDebugInfo()`
      Parameters:
        `includeDebugInfo` -
      Returns:
        self

    - #### addInterceptor

          public ServiceBinder addInterceptor(java.util.function.Function<Message<JsonObject>,Future<Message<JsonObject>>> interceptor)

    - #### register

          public <T> MessageConsumer<JsonObject> register(Class<T> clazz,
                                                          T service)

      Registers a service on the event bus.
      Type Parameters:
        `T` - the type of the service interface
      Parameters:
        `clazz` - the service class (interface)
        `service` - the service object
      Returns:
        the consumer used to unregister the service

    - #### registerLocal

          public <T> MessageConsumer<JsonObject> registerLocal(Class<T> clazz,
                                                               T service)

      Registers a local service on the event bus. The registration will not be propagated to other nodes in the cluster.
      Type Parameters:
        `T` - the type of the service interface
      Parameters:
        `clazz` - the service class (interface)
        `service` - the service object
      Returns:
        the consumer used to unregister the service

    - #### unregister

          public void unregister(MessageConsumer<JsonObject> consumer)

      Unregisters a published service.
      Parameters:
        `consumer` - the consumer returned by `register(Class, Object)`.

Copyright © 2021 Eclipse. All rights reserved.