Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.17 KB

options.md

File metadata and controls

63 lines (40 loc) · 1.17 KB

Operator Options

WithBufferedChannel

Configure the capacity of the output channel.

rxgo.WithBufferedChannel(1) // Create a buffered channel with a 1 capacity

WithContext

Allows passing a context. The Observable will listen to its done signal to close itself.

rxgo.WithContext(ctx)

WithObservationStrategy

  • Lazy (default): consume when an Observer starts to subscribe.
rxgo.WithObservation(rxgo.Lazy)
  • Eager: consumer when the Observable is created:
rxgo.WithObservation(rxgo.Eager)

WithErrorStrategy

  • Stop (default): stop processing if the Observable produces an error.
rxgo.WithErrorStrategy(rxgo.Stop)
  • Continue: continue processing items if the Observable produces an error.
rxgo.WithErrorStrategy(rxgo.Continue)

This strategy is propagated to the parent(s) Observable(s).

WithPool

Convert the operator in a parallel operator and specify the number of concurrent goroutines.

rxgo.WithPool(8) // Creates a pool of 8 goroutines

WithCPUPool

Convert the operator in a parallel operator and specify the number of concurrent goroutines as runtime.NumCPU().

rxgo.WithCPUPool()