Skip to content

CHR0070: [Observes<T>] is only for batch methods

[Observes<TEvent>] declares the event types of a batch method, a method whose first parameter is an EventBatch. A per-event method already declares its event type with its first parameter, so [Observes<TEvent>] on it has no meaning. Chronicle refuses to register the observer, so the mistake is reported at compile time.

Error

  • To handle the events one at a time, remove [Observes<TEvent>] and take the event as the first parameter.
  • To handle them together, make EventBatch the method’s first parameter and pattern-match on the events inside it.
  • CHR0071: Batch method observes no event types.
  • CHR0073: BatchContext is only for batch methods.