クラス PushNotificationService
java.lang.Object
org.iplass.mtp.impl.definition.AbstractTypedMetaDataService<org.iplass.mtp.impl.pushnotification.template.MetaPushNotificationTemplate,org.iplass.mtp.impl.pushnotification.template.MetaPushNotificationTemplate.PushNotificationTemplateRuntime>
org.iplass.mtp.impl.pushnotification.PushNotificationService
org.iplass.mtp.impl.pushnotification.fcmv1.PushNotificationService
- すべての実装されたインタフェース:
org.iplass.mtp.impl.definition.TypedMetaDataService<org.iplass.mtp.impl.pushnotification.template.MetaPushNotificationTemplate,,org.iplass.mtp.impl.pushnotification.template.MetaPushNotificationTemplate.PushNotificationTemplateRuntime> org.iplass.mtp.spi.Service
public class PushNotificationService
extends org.iplass.mtp.impl.pushnotification.PushNotificationService
Firebase Cloud Messaging (FCM) V1 API 通知サービス
FCM V1 API を利用した Push 通知を実現する機能です。 FCM については、FCM サービス概要 を確認すること。
Push通知を行う際の PushNotification は次のように設定されることを想定している。
PushNotification.setMessage(Map)に メッセージリソースの仕様 の通りに情報を設定する。宛先を含める。-
PushNotification.setMessage(Map)に メッセージリソースの仕様 の通りに情報が設定する。
宛先を含まない場合、PushNotification.addTo(String)で必要な宛先情報を追加する。
宛先には、宛先タイプを意味するプレフィックスを指定する必要がある。プレフィックスはPushNotificationTargetType.getPrefixedValue(String)を利用して付与する。 -
PushNotification.setMessage(Map)を利用しない場合、その他のメソッドに通知に関する情報を設定する。
その際、PushNotification.addTo(String)で必要な宛先情報を追加する。
宛先には、宛先タイプを意味するプレフィックスを指定する必要がある。プレフィックスはPushNotificationTargetType.getPrefixedValue(String)を利用して付与する。
- 関連項目:
-
ネストされたクラスの概要
クラスから継承されたネストされたクラス/インタフェース org.iplass.mtp.impl.pushnotification.PushNotificationService
org.iplass.mtp.impl.pushnotification.PushNotificationService.TypeMap -
フィールドの概要
クラスから継承されたフィールド org.iplass.mtp.impl.pushnotification.PushNotificationService
PUSH_NOTIFICATION_TEMPLATE_META_PATH -
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明voiddestroy()protected PushNotificationResponseDetailhandleResponse(PushNotificationTarget target, int code, String response, long retryAfterSeconds) 実行結果をハンドリングするvoidinit(org.iplass.mtp.spi.Config config) protected voidpostProcessOfReequestPushApi(PushNotificationResponseDetail responseDetail) 通知APIリクエスト後処理protected org.iplass.mtp.pushnotification.PushNotificationResultpushImpl(org.iplass.mtp.tenant.Tenant tenant, org.iplass.mtp.pushnotification.PushNotification notification) protected PushNotificationResponseDetailrequestPushApi(PushNotificationTarget target, Map<String, Object> messageResource) FCM V1 API リクエストを行うprotected PushNotificationResponseDetailrequestPushApiExponentialBackoff(PushNotificationTarget target, Map<String, Object> messageResource) 指数バックオフリトライを考慮した、FCM V1 API リクエストを行うクラスから継承されたメソッド org.iplass.mtp.impl.pushnotification.PushNotificationService
getFixedPath, getMetaDataType, getRuntimeType, pushクラスから継承されたメソッド org.iplass.mtp.impl.definition.AbstractTypedMetaDataService
createMetaData, getRuntimeById, getRuntimeByName, list, list, nameList, removeMetaData, updateMetaData
-
コンストラクタの詳細
-
PushNotificationService
public PushNotificationService()
-
-
メソッドの詳細
-
init
public void init(org.iplass.mtp.spi.Config config) - 定義:
initインタフェース内org.iplass.mtp.spi.Service- オーバーライド:
initクラス内org.iplass.mtp.impl.pushnotification.PushNotificationService
-
destroy
public void destroy()- 定義:
destroyインタフェース内org.iplass.mtp.spi.Service- オーバーライド:
destroyクラス内org.iplass.mtp.impl.pushnotification.PushNotificationService
-
pushImpl
protected org.iplass.mtp.pushnotification.PushNotificationResult pushImpl(org.iplass.mtp.tenant.Tenant tenant, org.iplass.mtp.pushnotification.PushNotification notification) - オーバーライド:
pushImplクラス内org.iplass.mtp.impl.pushnotification.PushNotificationService
-
requestPushApiExponentialBackoff
protected PushNotificationResponseDetail requestPushApiExponentialBackoff(PushNotificationTarget target, Map<String, Object> messageResource) 指数バックオフリトライを考慮した、FCM V1 API リクエストを行うリトライ可能なエラーの場合は、レスポンスヘッダ "retry-after" の秒数待ち再度リクエストを行う。 それ以外の場合は、リトライせず処理を終了する。
- パラメータ:
target- 宛先情報messageResource- メッセージリソース Map インスタンス- 戻り値:
- 実行結果
-
requestPushApi
protected PushNotificationResponseDetail requestPushApi(PushNotificationTarget target, Map<String, Object> messageResource) FCM V1 API リクエストを行うFCM 送信 API仕様 に沿ったリクエストを行う。 実行結果は
handleResponse(PushNotificationTarget, int, String, long)でハンドリングする- パラメータ:
target- 宛先情報messageResource- メッセージリソース Map インスタンス- 戻り値:
- 実行結果
-
handleResponse
protected PushNotificationResponseDetail handleResponse(PushNotificationTarget target, int code, String response, long retryAfterSeconds) throws IOException 実行結果をハンドリングする外部サービスの実行結果を受け、通知の結果を生成する。
- パラメータ:
target- 通知対象code- API 実行結果(HttpStatus)response- レスポンスボディretryAfterSeconds- 再実行間隔(秒)- 戻り値:
- 実行結果詳細インスタンス
- 例外:
IOException- 入出力例外
-
postProcessOfReequestPushApi
通知APIリクエスト後処理API の結果によって実行する処理を定義する。
- パラメータ:
responseDetail-
-