pub struct HttpStaticConsumer { /* private fields */ }Expand description
Consumer that registers a static file mount into the shared
[HttpRouteRegistry] and stays idle until cancelled.
On start:
- Canonicalizes the configured
dir(fails if not found). - Canonicalizes each
error_pagespath (fails if any don’t exist). - Builds a
ServeDirfor the directory. - Registers a
StaticMountinto the registry.
On stop (cancellation):
- Unregisters the mount from the registry.
Implementations§
Source§impl HttpStaticConsumer
impl HttpStaticConsumer
Sourcepub fn new(
config: HttpStaticConfig,
runtime: Arc<dyn RuntimeObservability>,
) -> Self
pub fn new( config: HttpStaticConfig, runtime: Arc<dyn RuntimeObservability>, ) -> Self
Create a new HttpStaticConsumer from the given config.
Trait Implementations§
Source§impl Consumer for HttpStaticConsumer
impl Consumer for HttpStaticConsumer
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
ctx: ConsumerContext,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
ctx: ConsumerContext,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start consuming messages, sending them through the provided context.
Source§fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop consuming messages and clean up all resources. Read more
Source§fn concurrency_model(&self) -> ConcurrencyModel
fn concurrency_model(&self) -> ConcurrencyModel
Declares this consumer’s natural concurrency model. Read more
Source§fn suspend<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn suspend<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Temporarily suspend consuming messages without fully stopping. Read more
Source§fn resume<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn resume<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Resume consuming after a previous suspension. Read more
Source§fn background_task_handle(
&mut self,
) -> Option<JoinHandle<Result<(), CamelError>>>
fn background_task_handle( &mut self, ) -> Option<JoinHandle<Result<(), CamelError>>>
Return a handle to the consumer’s long-running background task so the
runtime can monitor it for unexpected exits after
start() returns Ok. Read moreSource§fn set_security_context(&mut self, _ctx: SecurityContext)
fn set_security_context(&mut self, _ctx: SecurityContext)
Set the security context for this consumer. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for HttpStaticConsumer
impl !UnwindSafe for HttpStaticConsumer
impl Freeze for HttpStaticConsumer
impl Send for HttpStaticConsumer
impl Sync for HttpStaticConsumer
impl Unpin for HttpStaticConsumer
impl UnsafeUnpin for HttpStaticConsumer
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