pub struct StubProc<M>{
pub settings: StubSettings,
/* private fields */
}Expand description
Stub processor to respond to a request
use prosa::core::main::{MainProc, MainRunnable};
use prosa::core::proc::{proc, Proc, ProcBusParam, ProcConfig};
use prosa::stub::adaptor::StubParotAdaptor;
use prosa::stub::proc::{StubProc, StubSettings};
use prosa_utils::config::observability::Observability;
use prosa_utils::msg::simple_string_tvf::SimpleStringTvf;
use prosa::core::settings::settings;
use serde::Serialize;
// Main settings
#[settings]
#[derive(Default, Debug, Serialize)]
struct Settings {}
// Create bus and main processor
let settings = Settings::default();
let (bus, main) = MainProc::<SimpleStringTvf>::create(&settings, Some(1));
// Launch a stub processor
let stub_settings = StubSettings::new(vec![String::from("STUB_TEST")]);
let stub_proc = StubProc::<SimpleStringTvf>::create(1, "STUB_PROC".to_string(), bus.clone(), stub_settings);
Proc::<StubParotAdaptor>::run(stub_proc);
// Wait on main task
//main_task.await;Fields§
§settings: StubSettingsSettings of the processor
Trait Implementations§
Source§impl<A, M> Proc<A> for StubProc<M>
impl<A, M> Proc<A> for StubProc<M>
Source§async fn internal_run(&mut self) -> Result<(), Box<dyn ProcError + Send + Sync>>
async fn internal_run(&mut self) -> Result<(), Box<dyn ProcError + Send + Sync>>
Main loop of the processor to implement
Source§fn get_proc_threads(&self) -> usize
fn get_proc_threads(&self) -> usize
Get the number of processor threads the Processors’s
Runtime will use.
Must be implemented by the processor if more than one thread is to be used Read moreSource§impl<M> ProcBusParam for StubProc<M>
impl<M> ProcBusParam for StubProc<M>
Source§impl<M> ProcConfig<M> for StubProc<M>
impl<M> ProcConfig<M> for StubProc<M>
Source§type Settings = StubSettings
type Settings = StubSettings
Settings use for the ProSA processor
Source§fn create(
proc_id: u32,
proc_name: String,
main: Main<M>,
settings: Self::Settings,
) -> Self
fn create( proc_id: u32, proc_name: String, main: Main<M>, settings: Self::Settings, ) -> Self
Method to create a processor out of it’s configuration
Source§fn get_proc_param(&self) -> &ProcParam<M>
fn get_proc_param(&self) -> &ProcParam<M>
Getter of the processor parameters
Source§impl<M> ProcEpilogue for StubProc<M>
impl<M> ProcEpilogue for StubProc<M>
Source§fn get_proc_restart_delay(&self) -> (Duration, u32)
fn get_proc_restart_delay(&self) -> (Duration, u32)
Getter to know timer for processor restart in case of error
Source§async fn remove_proc(
&self,
err: Option<Box<dyn ProcError + Send + Sync>>,
) -> Result<(), BusError>
async fn remove_proc( &self, err: Option<Box<dyn ProcError + Send + Sync>>, ) -> Result<(), BusError>
Method to remove the processor with a signal queue to the main task Read more
Source§fn is_stopping(&self) -> bool
fn is_stopping(&self) -> bool
Indicates whether ProSA is stopping
Prevents the rebooting of processors
Auto Trait Implementations§
impl<M> Freeze for StubProc<M>
impl<M> !RefUnwindSafe for StubProc<M>
impl<M> Send for StubProc<M>
impl<M> Sync for StubProc<M>
impl<M> Unpin for StubProc<M>
impl<M> UnsafeUnpin for StubProc<M>
impl<M> !UnwindSafe for StubProc<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request