pub struct Context { /* private fields */ }
Expand description
Context provides configuration for the {@link Aeron} class via the {@link Aeron::Aeron} or {@link Aeron::connect} methods and its overloads. It gives applications some control over the interactions with the Aeron Media Driver. It can also set up error handling as well as application callbacks for connection information from the Media Driver.
Implementations§
Source§impl Context
impl Context
pub fn new() -> Self
pub fn conclude(&mut self) -> &Self
pub fn agent_name(&self) -> String
pub fn set_agent_name(&mut self, name: &str)
Sourcepub fn set_aeron_dir(&mut self, directory: String) -> &Self
pub fn set_aeron_dir(&mut self, directory: String) -> &Self
Set the directory that the Aeron client will use to communicate with the media driver.
@param directory to use @return reference to this Context instance
pub fn aeron_dir(&self) -> String
Sourcepub fn cnc_file_name(&self) -> String
pub fn cnc_file_name(&self) -> String
Return the path to the CnC file used by the Aeron client for communication with the media driver.
@return path of the CnC file
Sourcepub fn set_error_handler(
&mut self,
handler: impl ErrorHandler + Send + 'static,
) -> &Self
pub fn set_error_handler( &mut self, handler: impl ErrorHandler + Send + 'static, ) -> &Self
Set the handler for exceptions from the Aeron client.
@param handler called when exceptions arise @return reference to this Context instance
@see default_error_handler for how the default behavior is handled
pub fn error_handler(&self) -> Box<dyn ErrorHandler + Send + 'static>
Sourcepub fn set_new_publication_handler(
&mut self,
handler: impl OnNewPublication + 'static,
) -> &Self
pub fn set_new_publication_handler( &mut self, handler: impl OnNewPublication + 'static, ) -> &Self
Set the handler for successful Aeron::add_publication notifications.
@param handler called when add is completed successfully @return reference to this Context instance
pub fn new_publication_handler(&self) -> Box<dyn OnNewPublication>
Sourcepub fn set_new_exclusive_publication_handler(
&mut self,
handler: Box<dyn OnNewPublication>,
) -> &Self
pub fn set_new_exclusive_publication_handler( &mut self, handler: Box<dyn OnNewPublication>, ) -> &Self
Set the handler for successful Aeron::add_exclusive_publication notifications.
If not set, then will use new_publication_handler instead.
@param handler called when add is completed successfully @return reference to this Context instance
pub fn new_exclusive_publication_handler(&self) -> Box<dyn OnNewPublication>
Sourcepub fn set_new_subscription_handler(
&mut self,
handler: impl OnNewSubscription + 'static,
) -> &Self
pub fn set_new_subscription_handler( &mut self, handler: impl OnNewSubscription + 'static, ) -> &Self
Set the handler for successful Aeron::add_subscription notifications.
@param handler called when add is completed successfully @return reference to this Context instance
pub fn new_subscription_handler(&self) -> Box<dyn OnNewSubscription>
Sourcepub fn set_available_image_handler(
&mut self,
handler: impl OnAvailableImage + 'static,
) -> &Self
pub fn set_available_image_handler( &mut self, handler: impl OnAvailableImage + 'static, ) -> &Self
Set the handler for available image notifications.
@param handler called when event occurs @return reference to this Context instance
pub fn available_image_handler(&self) -> Box<dyn OnAvailableImage>
Set the handler for inactive image notifications.
@param handler called when event occurs @return reference to this Context instance
Sourcepub fn set_available_counter_handler(
&mut self,
handler: impl OnAvailableCounter + 'static,
) -> &Self
pub fn set_available_counter_handler( &mut self, handler: impl OnAvailableCounter + 'static, ) -> &Self
Set the handler for available counter notifications.
@param handler called when event occurs @return reference to this Context instance
pub fn available_counter_handler(&self) -> Box<dyn OnAvailableCounter>
Set the handler for inactive counter notifications.
@param handler called when event occurs @return reference to this Context instance
Sourcepub fn set_close_client_handler(
&mut self,
handler: impl OnCloseClient + 'static,
) -> &Self
pub fn set_close_client_handler( &mut self, handler: impl OnCloseClient + 'static, ) -> &Self
Set the handler to be called when the Aeron client is closed and not longer active.
@param handler to be called when the Aeron client is closed. @return reference to this Context instance.
pub fn close_client_handler(&self) -> Box<dyn OnCloseClient>
Sourcepub fn set_media_driver_timeout(&mut self, value: Moment) -> &Self
pub fn set_media_driver_timeout(&mut self, value: Moment) -> &Self
Set the amount of time, in milliseconds, that this client will wait until it determines the Media Driver is unavailable. When this happens a DriverTimeoutException will be generated for the error handler.
@param value Number of milliseconds. @return reference to this Context instance @see errorHandler
Sourcepub fn media_driver_timeout(&self) -> Moment
pub fn media_driver_timeout(&self) -> Moment
Get the amount of time, in milliseconds, that this client will wait until it determines the Media Driver is unavailable. When this happens a DriverTimeoutException will be generated for the error handler.
@return value in number of milliseconds. @see errorHandler
Sourcepub fn set_resource_linger_timeout(&mut self, value: Moment) -> &Self
pub fn set_resource_linger_timeout(&mut self, value: Moment) -> &Self
Set the amount of time, in milliseconds, that this client will to linger inactive connections and internal arrays before they are free’d.
@param value Number of milliseconds. @return reference to this Context instance
pub fn resource_linger_timeout(&self) -> Moment
Sourcepub fn set_use_conductor_agent_invoker(
&mut self,
use_conductor_agent_invoker: bool,
) -> &Self
pub fn set_use_conductor_agent_invoker( &mut self, use_conductor_agent_invoker: bool, ) -> &Self
Set whether to use an invoker to control the conductor agent or spawn a thread.
@param use_conductor_agent_invoker to use an invoker or not. @return reference to this Context instance
pub fn use_conductor_agent_invoker(&self) -> bool
Sourcepub fn set_pre_touch_mapped_memory(
&mut self,
pre_touch_mapped_memory: bool,
) -> &Self
pub fn set_pre_touch_mapped_memory( &mut self, pre_touch_mapped_memory: bool, ) -> &Self
Set whether memory mapped files should be pre-touched so they are pre-loaded to avoid later page faults.
@param pre_touch_mapped_memory true to pre-touch memory otherwise false. @return reference to this Context instance