Skip to main content

AuditContext

Struct AuditContext 

Source
pub struct AuditContext {
    pub message_type: Option<String>,
    pub release_code: Option<String>,
    pub pid: Option<u32>,
    pub sender_eic: Option<String>,
    pub receiver_eic: Option<String>,
    pub message_ref: Option<String>,
    pub process_id: Option<String>,
    pub tenant_id: Option<String>,
    pub correlation_id: Option<String>,
    pub timestamp: OffsetDateTime,
}
Expand description

Structured audit context attached to every dead-letter event.

All fields are Option because they are only partially known at rejection time (e.g. pid is not available for a parse failure before the PID is decoded). Callers fill in as many fields as they have.

These fields map to §22 MessZV audit-log requirements for AS4 message rejection events:

Field§22 MessZV requirement
message_typeNachrichtentyp (UTILMD, MSCONS, APERAK, …)
release_codeReleasekennung (S2.1, G1.1, 2.4c, …)
pidPrüfidentifikator
sender_eicGLN des Absenders
receiver_eicGLN des Empfängers
message_refUNH-Referenz
process_idGeschäftsvorfallkennung
tenant_idMandant
correlation_idAS4 ConversationId or similar
timestampZeitstempel des Eingangs (German local time)

Fields§

§message_type: Option<String>

EDIFACT message type (e.g. "UTILMD", "MSCONS", "APERAK").

§release_code: Option<String>

BDEW release code (e.g. "S2.1", "G1.1", "2.4c").

§pid: Option<u32>

BDEW Prüfidentifikator numeric code.

§sender_eic: Option<String>

GLN of the AS4 sender.

§receiver_eic: Option<String>

GLN of the AS4 receiver.

§message_ref: Option<String>

UNH message reference (interchange + message ref).

§process_id: Option<String>

Internal process / workflow stream ID.

§tenant_id: Option<String>

Tenant identifier (Mandant).

§correlation_id: Option<String>

AS4 ConversationId or engine correlation key.

§timestamp: OffsetDateTime

Timestamp of message receipt, in German local time (CET/CEST).

Implementations§

Source§

impl AuditContext

Source

pub fn now() -> Self

Create an AuditContext with only a timestamp, all other fields None.

Use builder-style setters to fill in known fields:

use mako_engine::dead_letter::AuditContext;

let ctx = AuditContext::now()
    .with_message_type("UTILMD")
    .with_pid(55001)
    .with_sender_eic("4012345000023");
Source

pub fn with_message_type(self, mt: impl Into<String>) -> Self

Set the message type.

Source

pub fn with_release_code(self, rc: impl Into<String>) -> Self

Set the BDEW release code.

Source

pub fn with_pid(self, pid: u32) -> Self

Set the Prüfidentifikator.

Source

pub fn with_sender_eic(self, eic: impl Into<String>) -> Self

Set the sender GLN.

Source

pub fn with_receiver_eic(self, eic: impl Into<String>) -> Self

Set the receiver GLN.

Source

pub fn with_message_ref(self, r: impl Into<String>) -> Self

Set the UNH message reference.

Source

pub fn with_process_id(self, id: impl Into<String>) -> Self

Set the internal process / stream ID.

Source

pub fn with_tenant_id(self, id: impl Into<String>) -> Self

Set the tenant identifier.

Source

pub fn with_correlation_id(self, id: impl Into<String>) -> Self

Set the AS4 correlation / conversation ID.

Trait Implementations§

Source§

impl Clone for AuditContext

Source§

fn clone(&self) -> AuditContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuditContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AuditContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more