Class NozzleMetricsService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.commons.core.service.AbstractConfigurableService<NozzleMetricsServiceConfig>
com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetricsService
- All Implemented Interfaces:
com.tccc.kos.commons.core.context.CtxEventListener
,com.tccc.kos.commons.core.service.config.ConfigAware<NozzleMetricsServiceConfig>
,com.tccc.kos.commons.core.service.handle.ContextHandleAware
,com.tccc.kos.commons.core.service.handle.HandleAware
,com.tccc.kos.commons.util.ready.Ready
,com.tccc.kos.commons.util.ready.ReadyListener
,BeveragePipelineListener
,BeveragePourListener
public class NozzleMetricsService
extends com.tccc.kos.commons.core.service.AbstractConfigurableService<NozzleMetricsServiceConfig>
implements BeveragePourListener
Manages all the pour metrics.
- Version:
- 2024-01-29
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddGlobalMetrics
(String name) Register global metrics with the service.addMetrics
(Nozzle nozzle, String name) Register metrics with the service relative to the specified nozzle.Return all the active metricsgetAllMetrics
(Nozzle nozzle) Return all the active metrics for the specified nozzle.getGlobalMetrics
(String name) Return the global metrics with the specified name.Return the list of global metrics names.getLastBeveragePourMetrics
(Nozzle nozzle) Return the metrics that track the most recent beverage pour.getMetrics
(Nozzle nozzle, String name) Return the metrics with the specified name for the specified nozzle.getMetricsNames
(Nozzle nozzle) Return the list of metrics names for the specified nozzle.Return the metrics that track total volume poured.void
onBeveragePourStart
(BeverageNozzlePipeline pipeline, BeveragePour pour) Called when a beverage pour is about to start.void
onBeveragePourStop
(BeverageNozzlePipeline pipeline, BeveragePour pour) Called when a pump intent is done.void
onConfigChanged
(com.tccc.kos.commons.core.service.config.BeanChanges changes) removeGlobalMetrics
(String name) Remove global metrics with the specified name.removeMetrics
(Nozzle nozzle, String name) Remove metrics with the specified name from the nozzle.void
removeNozzle
(Nozzle nozzle) Remove a nozzle.Methods inherited from class com.tccc.kos.commons.core.service.AbstractConfigurableService
getConfig, setConfig
Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.service.config.ConfigAware
onConfigSet
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getHandle, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.Ready
isReady, setReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
NO_INGREDIENT_ID
- See Also:
-
-
Constructor Details
-
NozzleMetricsService
public NozzleMetricsService()
-
-
Method Details
-
onConfigChanged
public void onConfigChanged(com.tccc.kos.commons.core.service.config.BeanChanges changes) - Specified by:
onConfigChanged
in interfacecom.tccc.kos.commons.core.service.config.ConfigAware<NozzleMetricsServiceConfig>
-
removeNozzle
Remove a nozzle. -
getTotalMetrics
Return the metrics that track total volume poured.- Returns:
- total pour metrics
-
getLastBeveragePourMetrics
Return the metrics that track the most recent beverage pour.- Parameters:
nozzle
- the nozzle to return metrics for- Returns:
- last pour metrics
-
addGlobalMetrics
Register global metrics with the service. These will be updated with pour data regardless of how the ingredient is poured (both beverage and ingredient pours). Adding a name that already exists will simply callreset()
on the existing metrics.Global metrics will track all pour data across all nozzles.
Internal metrics cannot be replaced and will throw
InvalidMetricsException
.- Parameters:
name
- name of the metrics to add / replace- Returns:
- the new metrics object
-
addMetrics
Register metrics with the service relative to the specified nozzle. These will be updated with pour data regardless of how the ingredient is poured (both beverage and ingredient pours). Adding a name that already exists will simply callreset()
on the existing metrics.This will track metrics specific to the specified nozzle.
Internal metrics cannot be replaced and will throw
InvalidMetricsException
.- Parameters:
nozzle
- the nozzle the metrics are relative toname
- name of the metrics to add / replace- Returns:
- the new metrics object
-
removeGlobalMetrics
Remove global metrics with the specified name.Internal metrics cannot be removed and will throw
InvalidMetricsException
- Parameters:
name
- name of the metrics to remove- Returns:
- the metrics that were removed
-
removeMetrics
Remove metrics with the specified name from the nozzle.Internal metrics cannot be removed and will throw
InvalidMetricsException
- Parameters:
nozzle
- the nozzle to remove metrics fromname
- name of the metrics to remove- Returns:
- the metrics that were removed
-
getGlobalMetricsNames
Return the list of global metrics names.- Returns:
- the list of global metrics names
-
getAllGlobalMetrics
Return all the active metrics -
getGlobalMetrics
Return the global metrics with the specified name.- Parameters:
name
- name of the metrics- Returns:
- the named metrics
-
getMetricsNames
Return the list of metrics names for the specified nozzle.- Parameters:
nozzle
- the nozzle to return names for- Returns:
- the list of metrics names
-
getAllMetrics
Return all the active metrics for the specified nozzle.- Parameters:
nozzle
- the nozzle to return metrics for- Returns:
- the list of metrics
-
getMetrics
Return the metrics with the specified name for the specified nozzle.- Parameters:
nozzle
- the nozzle to queryname
- name of the metrics- Returns:
- the named metrics
-
onBeveragePourStart
Description copied from interface:BeveragePourListener
Called when a beverage pour is about to start. When this is called, the pour has already been built from the sequence so no changes can be made.- Specified by:
onBeveragePourStart
in interfaceBeveragePourListener
- Parameters:
pipeline
- the pipeline generating the eventpour
- the pour that just started
-
onBeveragePourStop
Description copied from interface:BeveragePourListener
Called when a pump intent is done. The end state of the future indicates whether the intent was successful or not.- Specified by:
onBeveragePourStop
in interfaceBeveragePourListener
- Parameters:
pipeline
- the pipeline generating the eventpour
- the pour that just ended
-