Listener -
grpc
: Listener
Represents server listener where one or more services can be registered. so that ballerina program can offer service through this listener.
Constructor
__init
(int port, ListenerConfiguration? config)
- port int
-
Listener port
- config ListenerConfiguration? ()
-
The
grpc:ListenerConfiguration
of the endpoint
Methods
Stops the service listener gracefully.
Stops the registered service.
Detaches an HTTP or WebSocket service from the listener.
LifeCycle Methods
Methods
Stops the service listener gracefully. Already-accepted requests will be served before the connection closure.
error? result = listenerEp.__gracefulStop();
-
Return Type
(error?) An
error
if an error occurred during the listener stopping process or else()
Stops the registered service.
error? result = listenerEp.__immediateStop();
-
Return Type
(error?) An
error
if an error occurs while stopping the server or else()
Detaches an HTTP or WebSocket service from the listener. Note that detaching a WebSocket service would not affect the functionality of the existing connections.
error? result = listenerEp.__detach(helloService);
Parameters
- s service
-
The service to be detached
-
Return Type
(error?) An
error
if occurred during detaching of a service or else()
LifeCycle Methods
Starts the registered service.
error? result = listenerEp.__start();
-
Return Type
(error?) An
error
if an error occurs while starting the server or else()
Gets called every time a service attaches itself to this endpoint - also happens at module init time.
error? result = listenerEp.__attach(helloService);
Parameters
- s service
-
The type of the service to be registered
- name string? (default ())
-
Name of the service
-
Return Type
(error?) An
error
if encounters an error while attaching the service or else()