pub struct ApnsRouter {
clients: HashMap<String, ApnsClientData>,
settings: ApnsSettings,
endpoint_url: Url,
metrics: Arc<StatsdClient>,
db: Box<dyn DbClient>,
reliability: Arc<PushReliability>,
}Expand description
Apple Push Notification Service router
Fields§
§clients: HashMap<String, ApnsClientData>A map from release channel to APNS client
settings: ApnsSettings§endpoint_url: Url§metrics: Arc<StatsdClient>§db: Box<dyn DbClient>§reliability: Arc<PushReliability>Implementations§
Source§impl ApnsRouter
impl ApnsRouter
Sourcepub async fn new(
settings: ApnsSettings,
endpoint_url: Url,
metrics: Arc<StatsdClient>,
db: Box<dyn DbClient>,
reliability: Arc<PushReliability>,
) -> Result<Self, ApnsError>
pub async fn new( settings: ApnsSettings, endpoint_url: Url, metrics: Arc<StatsdClient>, db: Box<dyn DbClient>, reliability: Arc<PushReliability>, ) -> Result<Self, ApnsError>
Create a new APNS router. APNS clients will be initialized for each channel listed in the settings.
Sourceasync fn create_client(
name: String,
channel: ApnsChannel,
request_timeout_secs: Option<u64>,
pool_idle_timeout_secs: Option<u64>,
) -> Result<(String, ApnsClientData), ApnsError>
async fn create_client( name: String, channel: ApnsChannel, request_timeout_secs: Option<u64>, pool_idle_timeout_secs: Option<u64>, ) -> Result<(String, ApnsClientData), ApnsError>
Create an APNS client for the channel.
If key_id and team_id are set, the client uses token-based
authentication with the .p8 provider auth key in key. Otherwise it
falls back to certificate-based authentication with cert/key.
Sourceasync fn read_pem(value: &str) -> Result<Vec<u8>, ApnsError>
async fn read_pem(value: &str) -> Result<Vec<u8>, ApnsError>
Read PEM material that is either an inline value (starting with “-”,
e.g. -----BEGIN PRIVATE KEY-----) or a path to a file
Sourcefn default_aps<'a>() -> DefaultNotificationBuilder<'a>
fn default_aps<'a>() -> DefaultNotificationBuilder<'a>
The default APS data for a notification
Sourceasync fn handle_error(
&self,
error: Error,
uaid: Uuid,
channel: &str,
) -> ApiError
async fn handle_error( &self, error: Error, uaid: Uuid, channel: &str, ) -> ApiError
Handle an error by logging, updating metrics, etc
Sourcefn derive_aps<'a>(
&self,
replacement: Value,
holder: &'a mut ApsAlertHolder,
) -> Result<DefaultNotificationBuilder<'a>, ApnsError>
fn derive_aps<'a>( &self, replacement: Value, holder: &'a mut ApsAlertHolder, ) -> Result<DefaultNotificationBuilder<'a>, ApnsError>
Derive an APS message from the replacement JSON block.
This requires an external “holder” that contains the data that APS will refer to.
The holder should live in the same context as the aps.build() method.
Trait Implementations§
Source§impl Router for ApnsRouter
impl Router for ApnsRouter
Source§fn register(
&self,
router_input: &RouterDataInput,
app_id: &str,
) -> Result<HashMap<String, Value>, RouterError>
fn register( &self, router_input: &RouterDataInput, app_id: &str, ) -> Result<HashMap<String, Value>, RouterError>
router_data field.Source§fn route_notification<'life0, 'async_trait>(
&'life0 self,
notification: Notification,
) -> Pin<Box<dyn Future<Output = Result<RouterResponse, ApiError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn route_notification<'life0, 'async_trait>(
&'life0 self,
notification: Notification,
) -> Pin<Box<dyn Future<Output = Result<RouterResponse, ApiError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for ApnsRouter
impl !RefUnwindSafe for ApnsRouter
impl Send for ApnsRouter
impl Sync for ApnsRouter
impl Unpin for ApnsRouter
impl UnsafeUnpin for ApnsRouter
impl !UnwindSafe for ApnsRouter
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].