public class FCMMessagePublisher extends Object implements MessagePublisher
| Modifier and Type | Field and Description |
|---|---|
static String |
LOG_OPERATION_NAME |
static String |
LOG_SERVICE_NAME |
| Constructor and Description |
|---|
FCMMessagePublisher(org.exoplatform.container.xml.InitParams initParams,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService) |
FCMMessagePublisher(org.exoplatform.container.xml.InitParams initParams,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
org.apache.http.impl.client.CloseableHttpClient httpClient) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getAccessToken()
Retrieve the access token
|
protected com.google.api.client.googleapis.auth.oauth2.GoogleCredential |
getCredentialsFromStream(FCMServiceAccountConfiguration configuration)
Build GoogleCredential object from configuration
|
protected PrivateKey |
getPrivateKeyFromPkcs8(String privateKeyPem)
Build a PrivateKey from its string value
|
protected FCMServiceAccountConfiguration |
loadConfiguration(String fcmServiceAccountFilePath)
Load Firebase Cloud Messaging configuration from file
|
protected String |
processBody(Message message)
Process the notification message body:
* replace images by a text "inline image"
* escape double quotes
|
void |
send(Message message) |
public static final String LOG_SERVICE_NAME
public static final String LOG_OPERATION_NAME
public FCMMessagePublisher(org.exoplatform.container.xml.InitParams initParams,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService)
public FCMMessagePublisher(org.exoplatform.container.xml.InitParams initParams,
org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
org.apache.http.impl.client.CloseableHttpClient httpClient)
public void send(Message message) throws Exception
send in interface MessagePublisherExceptionprotected String processBody(Message message)
message - The raw message bodyprotected FCMServiceAccountConfiguration loadConfiguration(String fcmServiceAccountFilePath) throws IOException
fcmServiceAccountFilePath - IOExceptionprotected com.google.api.client.googleapis.auth.oauth2.GoogleCredential getCredentialsFromStream(FCMServiceAccountConfiguration configuration) throws Exception
configuration - Firebase Cloud Messaging configurationIOExceptionGeneralSecurityExceptionExceptionprotected PrivateKey getPrivateKeyFromPkcs8(String privateKeyPem) throws IOException
privateKeyPem - Private key valueIOExceptionprotected String getAccessToken() throws IOException
IOExceptionCopyright © 2003–2019 eXo Platform SAS. All rights reserved.