[#BloombergLP-balm-PublicationScheduler] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::PublicationScheduler :relfileprefix: ../../ :mrdocs: This class defines a mechanism for scheduling the periodic publication of metrics. Each publication scheduler object is supplied the address of a `MetricsManager` and a `bdlmt::TimerEventScheduler` at construction. The metrics manager is used to publish metrics, while the timer‐event scheduler provides the underlying scheduling mechanism. Metrics are scheduled for publication using the `scheduleCategory` and `setDefaultSchedule` methods. The `scheduleCategory` method schedules an individual category to be publisher periodically at the provided interval, whereas `setDefaultSchedule` schedules the periodic publication of any category not given an individual schedule. The publication scheduler will create a recurring timer for each unique time interval supplied, and will group together categories that share a common time interval into a single call to `MetricsManager::publish`. Note that it is left unspecified whether publication events that occur on a common multiple of _different_ intervals will be grouped into a single invocation of `MetricsManager::publish`. == Synopsis Declared in `<balm_publicationscheduler.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class PublicationScheduler; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balm/PublicationScheduler/2constructor.adoc[`PublicationScheduler`] [.small]#[constructor]# | Create a publication scheduler that will use the specified `metricsManager` to publish metrics, and the specified `eventScheduler` to supply timer events. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is 0, the currently installed default allocator is used. | xref:BloombergLP/balm/PublicationScheduler/2destructor.adoc[`~PublicationScheduler`] [.small]#[destructor]# | Destroy this publication scheduler and cancel any pending publications. Note that, if any metrics are currently being published, this operation will block until all of their publications have completed. | xref:BloombergLP/balm/PublicationScheduler/cancelAll.adoc[`cancelAll`] | Cancel all periodic publication of metrics. This operation (atomically) clears the default publication schedule and cancels the publication schedule of any category individually scheduled using the `scheduleCategory` method. Any scheduled publication is either canceled or completed before this method returns. | xref:BloombergLP/balm/PublicationScheduler/cancelCategorySchedule-06.adoc[`cancelCategorySchedule`] | `cancelCategorySchedule` overloads | xref:BloombergLP/balm/PublicationScheduler/clearDefaultSchedule.adoc[`clearDefaultSchedule`] | If the default publication schedule has been set (using `setDefaultSchedule`), cancel that periodic default publication, and return 0. This method has no effect and will return a non‐zero value if a default publication schedule has not been set. Any scheduled publication is either canceled or completed before this method returns. | xref:BloombergLP/balm/PublicationScheduler/findCategorySchedule-06.adoc[`findCategorySchedule`] | `findCategorySchedule` overloads | xref:BloombergLP/balm/PublicationScheduler/getCategorySchedule-09.adoc[`getCategorySchedule`] | `getCategorySchedule` overloads | xref:BloombergLP/balm/PublicationScheduler/getDefaultSchedule.adoc[`getDefaultSchedule`] | Load into the specified `result` the default scheduled interval, (set using the `setDefaultSchedule` method), for periodically publishing metrics, if found, and return `true`, or (if not found) return `false` with no effect. | xref:BloombergLP/balm/PublicationScheduler/manager-08.adoc[`manager`] | `manager` overloads | xref:BloombergLP/balm/PublicationScheduler/print.adoc[`print`] | Print a formatted string describing the current state of this `PublicationScheduler` object to the specified `stream` at the (absolute value of) the optionally specified indentation `level` and return a reference to `stream`. If `level` is specified, optionally specify `spacesPerLevel`, the number of spaces per indentation level for this and all of its nested objects. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, suppress all indentation AND format the entire output on one line. If `stream` is not valid on entry, this operation has no effect. Note that this is provided primarily for debugging purposes. | xref:BloombergLP/balm/PublicationScheduler/scheduleCategory-0b.adoc[`scheduleCategory`] | `scheduleCategory` overloads | xref:BloombergLP/balm/PublicationScheduler/setDefaultSchedule.adoc[`setDefaultSchedule`] | Set, to the specified `interval`, the default interval for metrics to be periodically published using the `MetricsManager` supplied at construction. This method schedules every metric category not given a individual schedule (using `scheduleCategory`), to be published periodically until that category is either given an individual schedule, or the default schedule is canceled (using either `clearDefaultSchedule` or `cancelAllPublications`). If a default publication has _already_ been scheduled, change its schedule to `interval`; any previously scheduled publication is either canceled or completed (atomically) before rescheduling. If the default publication is rescheduled with the same `interval` as it is currently scheduled, this operation has no effect. The behavior is undefined unless `bsls::TimeInterval(0, 0) < interval`. Note that, to exclude a category from any publication, clients can disable the category using the `MetricsManager` object supplied at construction. | xref:BloombergLP/balm/PublicationScheduler/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<PublicationScheduler, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/balm/PublicationScheduler_Proctor.adoc[BloombergLP::balm::PublicationScheduler_Proctor]` | defined in implementation |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#