Listener
List, Inser, Remove, Activate And Deactivate Orakl Network Listeners
The Orakl Network Listener is a microservice that is part of every Orakl Network solution (VRF, Request-Response). The listener configuration includes chain
, service
, address
and eventName
property. The Orakl Network Listener listens for an event defined as eventName
emitted from smart contract address
.
The Orakl Network CLI provides commands to modify both permanent or ephemeral state of Orakl Network Listener. The list of supported actions is shown below:
Permanent State
The permanent state of listener is loaded on launch of the Orakl Network Listener service. It is not accessed by other services such as the Orakl Network Worker or the Orakl Network Reporter.
List Listeners
Listeners kept in permanent state can be displayed with listener list
command. You can filter the listeners by using optional parameters: --chain
or --service
.
example
The example output of listener list
command is displayed below. It includes three different listeners that should listen on three addresses for three different events: RandomWordsRequested
, NewRound
and DataRequested
.
To list listeners associated with a specific chain, you can use the --chain
parameter.
example
To list listeners associated with a specific service, you can use the --service
parameter.
example
Insert New Listener
To insert a new listener to a permanent listener state, you can use the listener insert
command.
example
Remove Listener Specified By id
id
Listeners can be removed from a permanent listener state by the listener remove
command. The listener to remove is specified by its identifier (--id
).
example
Ephemeral State
The ephemeral state of listener is created during launch of the Orakl Network Listener service, and is used throughout its lifetime until it terminates. All commands from the Permanent State section will not have affect on the ephemeral state unless you apply the activate
or deactivate
commands that are described below.
Unlike the permanent listener state, the ephemeral listener state is accessed through a watchman that runs inside of Orakl Network Listener service. For this reason, every command that needs an access to ephemeral state has to specify a --host
and a --port
parameter that defines the location of the Orakl Network Listener service in the network.
List Active Listeners
All listeners that are part of the permanent state during the launch of the Orakl Network Listener service are automatically made active, and can be listed with listener active
command. Listeners that are later activated will be visible through this command as well. If a listener is not in an active state, it does not listen to the event from its configuration.
example
Activate Listener
Listeners that are added to the permanent listener state after the launch of the Orakl Network Listener service are inactive by default. Inactive listeners can be activated by the listener activate
command with --id
parameter. The listener identifier can be found through the listener list
command. After a listener becomes active, it starts listening for the events defined in its configuration.
example
Deactivate Listener
Every new active listener requires an extra computation resource, however, in general it operates with low overhead. When a listener spots an event for which it was listening for, it create a new job for the Orakl Network Worker, which then passes new job to the Orakl Network Reporter. The consequence of having an extra listener which we do need is an unnecessarily high load on the overall system.
To deactivate listener, and therefore to lower the load on the system, you can use listener deactivate
command.
example
If you do not want to use listener long-term, you should remove it from the permanent listener state, otherwise it will become active after the Orakl Network Listener restarts.
Last updated