class TriggerRequestManager: (source)
Manager for TriggerRequest functionality.
Note
This is a placeholder implementation that will be extended in the future to provide the actual functionality for managing TriggerRequests.
| Method | configure |
Configure the GroupManager with the provided configuration. |
| Method | determine |
Determine the NSE (Network Service Entity) for a given TriggerRequest. |
| Method | has |
Check if a given NSE is available. |
| Method | replace |
Attempt to replace an existing TriggerRequest that is currently being processed. |
| Method | restart |
Restart the TriggerRequestManager. |
| Method | send |
Handle the sending of a TriggerRequest to the determined NSE. |
| Method | start |
Start the TriggerRequestManager. |
| Method | stop |
Stop the TriggerRequestManager. |
| Method | terminate |
Terminate (or recall) a TriggerRequest that is currently being processed. |
| Method | validate |
Validate the GroupManager configuration. |
| Class Variable | trigger |
Dictionary to keep track of active TriggerRequest actors. The key is the TriggerRequest resource ID (ri), and the value is a tuple containing the BackgroundWorker instance and the corresponding TGR resource. |
| Method | _terminate |
Terminate all currently active TriggerRequests. This method is called when the TriggerRequestManager is stopped or restarted. |
| Method | _trigger |
Internal method to handle the actual sending of the TriggerRequest to the NSE. |
| Method | _trigger |
Internal method called when the trigger handler actor has completed its execution. |
Configure the GroupManager with the provided configuration.
| Parameters | |
config:Configuration | The configuration to apply. |
Determine the NSE (Network Service Entity) for a given TriggerRequest.
This method iterates through the registered triggerRequestHandler services that have the triggerRequestHandler tag and calls their acceptsM2MExtID` endpoint to determine if they can handle the provided TriggerRequest's M2M-Ext-ID.
| Parameters | |
tgr:TGR | The TriggerRequest resource for which to determine the NSE. |
| Returns | |
str | None | The first NSE service handler plugin's name if found, otherwise None. |
Check if a given NSE is available.
| Parameters | |
nse:str | The name of the NSE service handler plugin to check. |
| Returns | |
bool | True if the NSE is available, False otherwise. |
Attempt to replace an existing TriggerRequest that is currently being processed.
This method checks if the provided TriggerRequest is currently being processed by an actor. If it is, it attempts to terminate the existing processing and allows for a new TriggerRequest to be sent in its place.
| Parameters | |
tgr:TGR | The TriggerRequest resource that is attempting to replace an existing one. |
nse:str | The name of the NSE service handler plugin to which the TriggerRequest should be sent. |
| Returns | |
bool | True if the existing TriggerRequest was successfully terminated and replaced, False otherwise. |
Handle the sending of a TriggerRequest to the determined NSE.
This method is responsible for initiating the process of sending the TriggerRequest to the determined NSE. The actual sending process may be asynchronous and handled in the background.
| Parameters | |
tgr:TGR | The TriggerRequest resource to be sent. |
nse:str | The name of the NSE service handler plugin to which the TriggerRequest should be sent. |
replace:bool | A boolean indicating whether this is a replacement of an existing TriggerRequest. If True, the NSE handler may handle the request differently. |
Terminate (or recall) a TriggerRequest that is currently being processed.
This method is responsible for stopping any background processing related to the provided TriggerRequest. It should be called when a TriggerRequest is deleted or no longer needs to be processed.
This method also removes the TriggerRequest's actor from the triggerRequestActors dictionary and calls the terminateTriggerRequest endpoint of the assigned NSE service handler plugin to notify it of the termination.
| Parameters | |
tgr:TGR | The TriggerRequest resource to be terminated. |
replace:bool | A boolean indicating whether this termination is part of a replacement process. If True, the NSE handler may handle the termination differently. |
| Returns | |
bool | True if the TriggerRequest was successfully terminated, False otherwise. True is also returned if the TriggerRequest was not currently being processed. |
Validate the GroupManager configuration.
| Parameters | |
config:Configuration | The configuration to validate. |
Dictionary to keep track of active TriggerRequest actors. The key is the TriggerRequest resource ID (ri), and the value is a tuple containing the BackgroundWorker instance and the corresponding TGR resource.
Be aware that this Triggerrequest resource may be updated or deleted outside of this manager, so the manager should always check the current state of the resource before acting on it.
Terminate all currently active TriggerRequests. This method is called when the TriggerRequestManager is stopped or restarted.
Internal method to handle the actual sending of the TriggerRequest to the NSE.
This method is executed in a background worker and is responsible for the actual communication with the NSE. It should handle any necessary retries, error handling, and updating of the TriggerRequest's status based on the response from the NSE.
| Parameters | |
tgr:TGR | The TriggerRequest resource to be sent. |
nse:str | The name of the NSE service handler plugin to which the TriggerRequest should be sent. |
replace:bool | A boolean indicating whether this is a replacement of an existing TriggerRequest. If True, the NSE handler may handle the request differently. |
actor:BackgroundWorker | The background worker actor handling this trigger request. |
Internal method called when the trigger handler actor has completed its execution.
This method is responsible for cleaning up after the trigger handling process, including removing the actor from the triggerRequestActors dictionary and performing any necessary finalization steps.
| Parameters | |
tgr:TGR | The TriggerRequest resource that was being processed. |
nse:str | The name of the NSE service handler plugin to which the TriggerRequest was sent. |
actor:BackgroundWorker | The background worker actor that handled this trigger request. |