@@ -4153,9 +4153,101 @@ impl AtlasConfigFile {
4153
4153
#[ derive( Clone , Deserialize , Default , Debug , Hash , PartialEq , Eq , PartialOrd ) ]
4154
4154
#[ serde( deny_unknown_fields) ]
4155
4155
pub struct EventObserverConfigFile {
4156
+ /// URL endpoint (hostname and port) where event notifications will be sent via HTTP POST requests.
4157
+ ///
4158
+ /// The node will automatically prepend `http://` to this endpoint and append the
4159
+ /// specific event path (e.g., `/new_block`, `/new_mempool_tx`).
4160
+ /// Therefore, this value should be specified as `hostname:port` (e.g., "localhost:3700").
4161
+ ///
4162
+ /// **Do NOT include the `http://` scheme in this configuration value.**
4163
+ ///
4164
+ /// This should point to a service capable of receiving and processing Stacks event data.
4165
+ ///
4166
+ /// Default: No default. This field is required.
4156
4167
pub endpoint : String ,
4168
+ /// List of event types that this observer wants to receive.
4169
+ ///
4170
+ /// Each string in the list specifies an event category or a specific event to subscribe to.
4171
+ /// Providing an invalid string that doesn't match any of the valid formats below will cause
4172
+ /// the node to panic on startup when parsing the configuration.
4173
+ /// For an observer to receive any notifications, this list must contain at least one valid key.
4174
+ ///
4175
+ /// Valid string values and their corresponding event types:
4176
+ /// - `"*"`: Subscribes to a broad set of events. Specifically, an observer with `"*"` will receive:
4177
+ /// - Payloads on `/new_block` if the block contains any transactions generating STX, FT, NFT, or smart contract events.
4178
+ /// - Payloads on `/new_microblocks` for all new microblock streams. NOTE: Only until epoch 2.5.
4179
+ /// - Payloads on `/new_mempool_tx` for new mempool transactions.
4180
+ /// - Payloads on `/drop_mempool_tx` for dropped mempool transactions.
4181
+ /// - Payloads on `/new_burn_block` for new burnchain blocks.
4182
+ /// - (Implicitly, like all observers) Payloads on `/attachments/new`.
4183
+ /// It does NOT by itself subscribe to `/stackerdb_chunks` or `/proposal_response`.
4184
+ /// - `"stx"`: Subscribes to STX token operation events (transfer, mint, burn, lock).
4185
+ /// These are delivered as part of new block or microblock event payloads sent to
4186
+ /// the `/new_block` or `/new_microblocks` paths, with the "events" array filtered to include STX-related events.
4187
+ /// - `"memtx"`: Subscribes to new and dropped mempool transaction events.
4188
+ /// Payloads are sent to `/new_mempool_tx` and `/drop_mempool_tx` paths respectively.
4189
+ /// - `"burn_blocks"`: Subscribes to new burnchain block events.
4190
+ /// Payloads are sent to the `/new_burn_block` path.
4191
+ /// - `"microblocks"`: Subscribes to new microblock stream events. NOTE: Only until epoch 2.5.
4192
+ /// Payloads are sent to the `/new_microblocks` path.
4193
+ /// The payload's "transactions" field will contain all transactions from the microblocks.
4194
+ /// The payload's "events" field will contain STX, FT, NFT, or specific smart contract events
4195
+ /// *only if* this observer is also subscribed to those more specific event types (e.g., via `"stx"`, `"*"`,
4196
+ /// a specific contract event key, or a specific asset identifier key).
4197
+ /// - `"stackerdb"`: Subscribes to StackerDB chunk update events.
4198
+ /// Payloads are sent to the `/stackerdb_chunks` path.
4199
+ /// - `"block_proposal"`: Subscribes to block proposal response events (for Nakamoto consensus).
4200
+ /// Payloads are sent to the `/proposal_response` path.
4201
+ /// - Smart Contract Event (format: `"{contract_address}.{contract_name}::{event_name}"`):
4202
+ /// Subscribes to a specific smart contract event. The `{contract_address}.{contract_name}` part identifies the contract,
4203
+ /// and `::{event_name}` specifies the event defined within that contract.
4204
+ /// Example: `"ST0000000000000000000000000000000000000000.my-contract::my-custom-event"`
4205
+ /// These are delivered as part of `/new_block` or `/new_microblocks` payloads, with the "events" array filtered for this specific event.
4206
+ /// - Asset Identifier for FT/NFT Events (format: `"{contract_address}.{contract_name}.{asset_name}"`):
4207
+ /// Subscribes to events (mint, burn, transfer) for a specific Fungible Token (FT) or Non-Fungible Token (NFT).
4208
+ /// Example for an FT: `"ST0000000000000000000000000000000000000000.my-ft-contract.my-fungible-token"`
4209
+ /// These are delivered as part of `/new_block` or `/new_microblocks` payloads, with the "events" array filtered for the specified asset.
4210
+ ///
4211
+ /// **Example `events_keys` in TOML:**
4212
+ /// ```toml
4213
+ /// events_keys = [
4214
+ /// "burn_blocks",
4215
+ /// "memtx",
4216
+ /// "ST0000000000000000000000000000000000000000.my-contract::my-custom-event", // Smart contract event
4217
+ /// "ST0000000000000000000000000000000000000000.token-contract.my-ft" // Fungible token asset event
4218
+ /// ]
4219
+ /// ```
4220
+ ///
4221
+ /// Default: No default. This field is required.
4157
4222
pub events_keys : Vec < String > ,
4223
+ /// Maximum duration (in milliseconds) to wait for the observer endpoint to respond.
4224
+ ///
4225
+ /// When the node sends an event notification to this observer, it will wait at most this long
4226
+ /// for a successful HTTP response (status code 200) before considering the request timed out.
4227
+ /// If a timeout occurs and retries are enabled (see [`EventObserverConfig::disable_retries`]),
4228
+ /// the request will be attempted again according to the retry strategy.
4229
+ ///
4230
+ /// Default: `1_000` ms (1 second).
4158
4231
pub timeout_ms : Option < u64 > ,
4232
+ /// Controls whether the node should retry sending event notifications if delivery fails or times out.
4233
+ ///
4234
+ /// - If `false` (default): The node will attempt to deliver event notifications persistently.
4235
+ /// If an attempt fails (due to network error, timeout, or a non-200 HTTP response),
4236
+ /// the event payload is typically saved to a local database (if [`NodeConfig::working_dir`] is configured for the node)
4237
+ /// and retried indefinitely. This ensures that, under normal circumstances, all events will eventually be delivered.
4238
+ /// However, this can cause the node's own block processing to stall if an observer is down,
4239
+ /// or fails to process the event.
4240
+ ///
4241
+ /// - If `true`: The node will make only a single attempt to deliver each event notification.
4242
+ /// If this single attempt fails for any reason, the event is discarded, and no further
4243
+ /// retries will be made for that specific event. The local database for pending payloads is
4244
+ /// not used for this observer.
4245
+ ///
4246
+ /// **Warning:** Setting this to `true` can lead to missed events if the observer endpoint is
4247
+ /// temporarily unavailable or experiences issues. This setting should only be used for observers
4248
+ /// where completeness of the event history is not critical.
4249
+ ///
4250
+ /// Default: `false` (retries are enabled).
4159
4251
pub disable_retries : Option < bool > ,
4160
4252
}
4161
4253
0 commit comments