Package ch.psi.wica.services.stream
Class WicaStreamMonitoredValueRequesterService
java.lang.Object
ch.psi.wica.services.stream.WicaStreamMonitoredValueRequesterService
@Configuration
@EnableScheduling
@Service
@ThreadSafe
public class WicaStreamMonitoredValueRequesterService
extends Object
Provides a service for starting and stopping the control system monitoring
of the channels in a WicaStream.
-
Constructor Summary
ConstructorsConstructorDescriptionWicaStreamMonitoredValueRequesterService
(int wicaChannelResourceReleaseIntervalInSecs, boolean wicaChannelPublishMonitorRestarts, boolean wicaChannelPublishChannelValueInitialState, org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method runs periodically to scan the discard list for entries corresponding to monitored channels that are no longer of interest(package private) int
getInterestCountForChannel
(WicaChannel wicaChannel) Returns the level of interest in a WicaChannel.(package private) Optional
<LocalDateTime> getLastEventForChannel
(WicaChannel wicaChannel) Returns the timestamp of the last event(package private) void
restartMonitoring
(WicaStream wicaStream) Restarts the control system monitoring of the channels in the specified stream.(package private) void
startMonitoring
(WicaStream wicaStream) Starts monitoring the channels in the specified stream.(package private) void
stopMonitoring
(WicaStream wicaStream) Stops monitoring the channels in the specified stream.
-
Constructor Details
-
WicaStreamMonitoredValueRequesterService
WicaStreamMonitoredValueRequesterService(@Value("${wica.channel-resource-release-interval-in-secs}") int wicaChannelResourceReleaseIntervalInSecs, @Value("${wica.channel-publish-monitor-restarts}") boolean wicaChannelPublishMonitorRestarts, @Value("${wica.channel-publish-channel-value-initial-state}") boolean wicaChannelPublishChannelValueInitialState, @Autowired org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Constructs a new instance.- Parameters:
wicaChannelResourceReleaseIntervalInSecs
- period after which the resources associated with a Wica Channel will be released if they are no longer in use.wicaChannelPublishMonitorRestarts
- determines whether a channel disconnect value will be published if the monitoring associated with the channel is restarted.wicaChannelPublishChannelValueInitialState
- determines whether a channel's initial value will be published as DISCONNECTED when a channel is first created or whether nothing will be published until the first monitored value is acquired.applicationEventPublisher
- reference to the application publisher which will be used to publish the channels that are to be monitored or which are no longer of interest.
-
-
Method Details
-
discardMonitorsThatHaveReachedEndOfLife
@Scheduled(fixedRate=1000L) public void discardMonitorsThatHaveReachedEndOfLife()This method runs periodically to scan the discard list for entries corresponding to monitored channels that are no longer of interest -
restartMonitoring
Restarts the control system monitoring of the channels in the specified stream.- Parameters:
wicaStream
- the stream on which monitoring is to be restarted.
-
startMonitoring
Starts monitoring the channels in the specified stream.- Parameters:
wicaStream
- the stream to monitor.
-
stopMonitoring
Stops monitoring the channels in the specified stream.- Parameters:
wicaStream
- the stream that is no longer of interest.
-
getInterestCountForChannel
Returns the level of interest in a WicaChannel.- Parameters:
wicaChannel
- the name of the channel to lookup.- Returns:
- the current interest count (or zero if the channel was not recognised).
- Implementation Note:
- this method is provided mainly for test purposes.
-
getLastEventForChannel
Returns the timestamp of the last event- Parameters:
wicaChannel
- the name of the channel to lookup.- Returns:
- the current interest count (or zero if the channel was not recognised).
- Implementation Note:
- this method is provided mainly for test purposes.
-