pub trait Application: Send + Sync {
// Required methods
fn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn from_admin<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn from_app<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
Application callback interface for handling FIX messages.
Implement this trait to receive callbacks for session events and message processing.
§Where each callback runs
Application::to_admin and Application::to_app run inline in the
session reactor, on the message the engine is about to encode and
number. That is what makes their mutations effective, and it is why they
cannot be moved off the reactor: the message they hand back is the one that
gets a sequence number. A slow implementation delays the session’s own
timers.
Application::from_admin also runs inline, because its verdict decides
what the session does next — whether a SequenceReset is applied, whether
the Logon is accepted — and that decision cannot be taken before the
verdict exists.
Application::from_app runs on a separate dispatcher task fed by a
bounded queue, so a slow handler no longer stalls socket reads, heartbeat
generation or timeout detection. Messages reach it in ascending
MsgSeqNum order. The only consequence of a rejection — a session-level
Reject carrying RefSeqNum — is emitted by the reactor when it next polls,
so it may follow messages that arrived after the rejected one. See
Initiator::with_app_queue_capacity
for the queue depth and what happens when it fills.
Required Methods§
Sourcefn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before an administrative message (Logon, Heartbeat, Logout, …) is encoded.
The body is mutable and the mutation is effective: the engine encodes
exactly the message this callback hands back. Fields appended here land
after the ones the session layer wrote, in insertion order. The
canonical use is stamping Username (553) and Password (554) onto the
outbound Logon.
The standard header is not visible: it is stamped after this returns,
and MsgSeqNum (34) is not decided until the frame exists. A body that
carries a tag the engine stamps itself, or a value with no legal wire
form, is refused — the message is dropped with a warning and the session
continues, having spent no sequence number. See
crate::outbound::RESERVED_TAGS.
§Arguments
message- The message about to be encoded (mutable)session_id- The session identifier
Sourcefn from_admin<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn from_admin<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Sourcefn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut OutboundMessage,
session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before an application message is encoded.
Same contract as Application::to_admin: the body is mutable, the
mutation is effective, and the header — including MsgSeqNum (34) — is
stamped afterwards.
§Arguments
message- The message about to be encoded (mutable)session_id- The session identifier
Sourcefn from_app<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn from_app<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 RawMessage<'life2>,
session_id: &'life3 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), RejectReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".