Module RelayOSGi runtime fieldbook
OSGi · Dynamic Module SystemsView Markdown source

Events, logging, promises, and asynchronous flows

OSGi supplies several collaboration styles; use each for its real semantics.

Event Admin

Event Admin sends topic-based events with properties. Synchronous delivery propagates on the caller's thread; asynchronous delivery decouples time but is not a durable message broker.

Use Event Admin for in-process notifications. Do not claim it survives process crashes, gives exactly-once delivery, or replaces Kafka/JMS.

Typed Event

Typed Event provides type-safe event models while retaining OSGi dynamics. Define ownership, ordering, error handling, and whether listeners may block.

Log Service

The OSGi Log Service associates entries with bundles, services, and log levels. Log Reader and Log Stream enable observation. Bridge carefully to SLF4J or a runtime backend to avoid loops and duplicate bindings.

Promises and Push Streams

Promise represents a future result with success/failure composition. Push Stream models asynchronous streams with buffering and backpressure concepts. They are useful when asynchronous APIs are genuine—not as decoration over blocking work.

Threading rules

  • document the thread that calls consumers;
  • never hold framework or component locks across slow work;
  • close streams and executors with lifecycle;
  • bound queues and concurrency;
  • preserve diagnostic context across async boundaries.

Feynman check

An event tells listeners something happened now. A durable message records work that must survive failure. Explain which one an invoice settlement requires.

Module RelayIndependent study material · verify runtime details in official project documentation