Skip to main content

ErpCommandSource

Trait ErpCommandSource 

Source
pub trait ErpCommandSource:
    Send
    + Sync
    + 'static {
    // Required methods
    async fn next(&self) -> Result<Option<InboundErpCommand>, ErpAdapterError>;
    async fn ack(&self, id: &str) -> Result<(), ErpAdapterError>;
    async fn nack(&self, id: &str, reason: &str) -> Result<(), ErpAdapterError>;
}
Expand description

Inbound command source — mako-engine polls this for new BO4E objects from the ERP.

Implement this for broker-based inbound flows (Kafka consumer, SFTP poll, database change feed, …) to make the entire integration fully event-driven — no synchronous REST round-trip required.

§Contract

  • next must be non-blocking when idle — return Ok(None) immediately when no command is available.
  • ack must suppress re-delivery of id after a successful ack (idempotent).
  • nack should allow re-delivery of id after an appropriate backoff.

Required Methods§

Source

async fn next(&self) -> Result<Option<InboundErpCommand>, ErpAdapterError>

Return the next pending BO4E command, or None when the source is idle.

Source

async fn ack(&self, id: &str) -> Result<(), ErpAdapterError>

Acknowledge successful processing of id.

After a successful ack the source must not re-deliver id.

Source

async fn nack(&self, id: &str, reason: &str) -> Result<(), ErpAdapterError>

Negative-acknowledge — allow re-delivery of id after backoff.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: ErpCommandSource> ErpCommandSource for Arc<S>

Blanket Arc implementation so ErpCommandSource can be shared across tasks.

Source§

async fn next(&self) -> Result<Option<InboundErpCommand>, ErpAdapterError>

Source§

async fn ack(&self, id: &str) -> Result<(), ErpAdapterError>

Source§

async fn nack(&self, id: &str, reason: &str) -> Result<(), ErpAdapterError>

Implementors§