クラス 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 は次のように設定されることを想定している。

  1. PushNotification.setMessage(Map) に メッセージリソースの仕様 の通りに情報を設定する。宛先を含める。
  2. PushNotification.setMessage(Map) に メッセージリソースの仕様 の通りに情報が設定する。
    宛先を含まない場合、PushNotification.addTo(String) で必要な宛先情報を追加する。
    宛先には、宛先タイプを意味するプレフィックスを指定する必要がある。プレフィックスは PushNotificationTargetType.getPrefixedValue(String) を利用して付与する。
  3. 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
  • コンストラクタの概要

    コンストラクタ
    コンストラクタ
    説明
     
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    void
     
    handleResponse(PushNotificationTarget target, int code, String response, long retryAfterSeconds)
    実行結果をハンドリングする
    void
    init(org.iplass.mtp.spi.Config config)
     
    protected void
    通知APIリクエスト後処理
    protected org.iplass.mtp.pushnotification.PushNotificationResult
    pushImpl(org.iplass.mtp.tenant.Tenant tenant, org.iplass.mtp.pushnotification.PushNotification notification)
     
    FCM V1 API リクエストを行う
    指数バックオフリトライを考慮した、FCM V1 API リクエストを行う

    クラスから継承されたメソッド org.iplass.mtp.impl.pushnotification.PushNotificationService

    getFixedPath, getMetaDataType, getRuntimeType, push

    クラスから継承されたメソッド org.iplass.mtp.impl.definition.AbstractTypedMetaDataService

    checkDefinitionName, createMetaData, getRuntimeById, getRuntimeByName, list, list, nameList, removeMetaData, updateMetaData

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • コンストラクタの詳細

    • 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

      protected void postProcessOfReequestPushApi(PushNotificationResponseDetail responseDetail)
      通知APIリクエスト後処理

      API の結果によって実行する処理を定義する。

      パラメータ:
      responseDetail -