Skip to main content

configure

Function configure 

Source
pub fn configure(photon: Photon)
Expand description

Configure the default Photon instance used by macro-generated convenience helpers (Type::publish() / Type::subscribe()).

Prefer passing an explicit Photon handle via publish_on / subscribe_on or Photon::publish. This process-wide shim is optional sugar for simple hosts.

§Example

use std::sync::Arc;

use photon_core::JsonIdentityFactory;
use photon_runtime::{configure, Photon};

let photon = Photon::builder().auto_registry().build()?;
photon.start_executor(Arc::new(JsonIdentityFactory))?;
configure(photon);

§Panics

Panics if an internal lock is poisoned.