Skip to main content

pamoja_event_publisher_publish

Function pamoja_event_publisher_publish 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_event_publisher_publish( publisher: *const PamojaEventPublisher, payload: *const u8, payload_len: usize, out_reached: *mut usize, ) -> PamojaStatus
Expand description

Hands an event to every current subscriber.

The call never waits, and it may be made from any thread.

§Arguments

  • publisher - the publisher.
  • payload - the event bytes.
  • payload_len - the length of payload.
  • out_reached - receives how many subscribers the event was handed to; an event published while no one is subscribed is dropped, and this is 0.

§Returns

PamojaStatus::Ok on success.

§Safety

publisher must be a live handle, payload must point to at least payload_len readable bytes or be null when that length is 0, and out_reached must be writable.