PubSub31
Constructors
boundedconstCreates a bounded PubSub that applies backpressure when it reaches capacity.droppingconstCreates a bounded PubSub with the dropping strategy.makeconstCreates a PubSub with a custom atomic implementation and strategy.makeAtomicBoundedconstCreates a bounded atomic PubSub implementation with optional replay buffer.makeAtomicUnboundedconstCreates an unbounded atomic PubSub implementation with optional replay buffer.slidingconstCreates a bounded PubSub with the sliding strategy.unboundedconstCreates an unbounded PubSub.Models
BackPressureStrategyclassRepresents the back-pressure strategy for bounded PubSub values.DroppingStrategyclassRepresents the dropping strategy for bounded PubSub values.PubSubinterfaceA PubSub<A> is an asynchronous message hub into which publishers can publish messages of type A and subscribers can subscribe to take messages of type A.SlidingStrategyclassRepresents the sliding strategy for bounded PubSub values.SubscriptioninterfaceA subscription represents a consumer's connection to a PubSub, allowing them to take messages.Getters
capacityconstReturns the number of elements the queue can hold.remainingconstReturns the number of messages currently available in the subscription as an Effect.remainingUnsafeconstSynchronously returns the number of messages currently available in the subscription, or Option.none() when it is shut down.sizeconstReturns the current number of messages retained by the PubSub for active subscribers.sizeUnsafeconstReturns the current number of messages retained by the PubSub for active subscribers synchronously.Lifecycle
Predicates
isEmptyconstReturns true if the Pubsub contains zero elements, false otherwise.isFullconstReturns true when the PubSub has reached its configured capacity.isShutdownconstChecks effectfully whether shutdown has been called, returning true after shutdown and false otherwise.isShutdownUnsafeconstChecks synchronously whether shutdown has been called, returning true after shutdown and false otherwise.Publishing
publishconstPublishes a message to the PubSub as an Effect, returning whether the message was accepted.publishAllconstPublishes all of the specified messages to the PubSub, returning whether they were published to the PubSub.publishUnsafeconstAttempts to publish a message synchronously without applying the PubSub strategy's effectful surplus handling.Subscriptions
subscribeconstSubscribes to receive messages from the PubSub.takeconstTakes a single message from the subscription.takeAllconstTakes all available messages from the subscription, suspending if no items are available.takeBetweenconstTakes between the specified minimum and maximum number of messages from the subscription.takeUpToconstTakes up to the specified number of messages from the subscription without suspending.