Class ServiceBinder
java.lang.Object
io.vertx.serviceproxy.ServiceBinder
A binder for Service Proxies which state can be reused during the binder lifecycle.
- Author:
- Paulo Lopes
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor(ServiceInterceptor interceptor) addInterceptor(String action, ServiceInterceptor interceptor) Registers a service on the event bus.registerLocal(Class<T> clazz, T service) Registers a local service on the event bus.setAddress(String address) Set the address to use on the subsequent proxy creations or service registrations.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 withServiceException.getDebugInfo()setTimeoutSeconds(long timeoutSeconds) Set the default timeout in seconds while waiting for a reply.setTopLevel(boolean topLevel) Set if the services to create are a top level services.voidunregister(MessageConsumer<JsonObject> consumer) Unregisters a published service.
-
Field Details
-
DEFAULT_CONNECTION_TIMEOUT
public static final long DEFAULT_CONNECTION_TIMEOUT- See Also:
-
-
Constructor Details
-
ServiceBinder
Creates a factory.- Parameters:
vertx- a non null instance of vertx.
-
-
Method Details
-
setAddress
Set the address to use on the subsequent proxy creations or service registrations.- Parameters:
address- an eventbus address- Returns:
- self
-
setTopLevel
Set if the services to create are a top level services.- Parameters:
topLevel- true for top level (default: true)- Returns:
- self
-
setTimeoutSeconds
Set the default timeout in seconds while waiting for a reply.- Parameters:
timeoutSeconds- the default timeout (default: 5 minutes)- Returns:
- self
-
setIncludeDebugInfo
When an exception is thrown by the service or the underlying handler, include debugging info in the ServiceException, that you can access withServiceException.getDebugInfo()- Parameters:
includeDebugInfo- the parameter- Returns:
- self
-
addInterceptor
-
addInterceptor
-
register
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
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
Unregisters a published service.- Parameters:
consumer- the consumer returned byregister(Class, Object).
-