Example usage for com.amazonaws.services.sns.model PublishResult getMessageId

List of usage examples for com.amazonaws.services.sns.model PublishResult getMessageId

Introduction

In this page you can find the example usage for com.amazonaws.services.sns.model PublishResult getMessageId.

Prototype


public String getMessageId() 

Source Link

Document

Unique identifier assigned to the published message.

Usage

From source file:AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(SampleMessageGenerator.Platform platform, String principal, String credential,
        String platformToken, String applicationName,
        Map<SampleMessageGenerator.Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//from w w  w .j  a va  2  s .  com
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.adeptj.modules.aws.sns.api.AwsSnsAsyncHandler.java

License:Apache License

@Override
default void onSuccess(PublishRequest request, PublishResult result) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("SMS sent to: [{}]", request.getPhoneNumber());
        LOGGER.debug("SNS PublishResult messageId: [{}]", result.getMessageId());
    }/*www.  java  2  s  . c  om*/
}

From source file:com.adeptj.modules.aws.sns.internal.AwsSnsService.java

License:Apache License

@Override
public SmsResponse sendSms(SmsRequest smsRequest) {
    try {/*w  w  w  .  j a va2  s . c  o  m*/
        PublishResult result = this.asyncSNS.publish(new PublishRequest().withMessage(smsRequest.getMessage())
                .withPhoneNumber(smsRequest.getCountryCode() + smsRequest.getPhoneNumber())
                .withMessageAttributes(this.smsAttributes));
        return new SmsResponse(result.getMessageId(), result.getSdkHttpMetadata().getHttpStatusCode(),
                result.getSdkHttpMetadata().getHttpHeaders());
    } catch (Exception ex) {
        LOGGER.error("Exception while sending SMS!!", ex);
        throw new AwsException(ex.getMessage(), ex);
    }
}

From source file:com.aws.sns.service.notifications.sns.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap, String messageText,
        String payloadAction, String collapseKey) {

    // Create Platform Application. This corresponds to an app on a
    // platform.//  ww w  .ja v a 2 s .co m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap,
            messageText, payloadAction, collapseKey);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.dev.appx.sns.tools.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//  w  w  w . java 2s  .c o m
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.gafful.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform.//www  .ja v a2 s  . co m
    //      CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(
    //            applicationName, platform, principal, credential);
    //      System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    //      String platformApplicationArn = platformApplicationResult
    //            .getPlatformApplicationArn();

    String platformApplicationArn = "arn:aws:sns:us-east-1:856247355946:app/GCM/testiWalletPush";

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    //      deletePlatformApplication(platformApplicationArn);
}

From source file:com.gafful.AmazonSNSClientWrapper.java

License:Open Source License

public void createPlatformEndpointResult(Platform platform, String platformApplicationArn, String platformToken,
        Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform./*  www .java2s.  c o m*/
    //      CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(
    //            applicationName, platform, principal, credential);
    //      System.out.println(platformApplicationResult);
    //
    //      // The Platform Application Arn can be used to uniquely identify the
    //      // Platform Application.
    //      String platformApplicationArn = platformApplicationResult
    //            .getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.hrt.modules.aws.sns.AmazonSnsClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap) {
    // Create Platform Application. This corresponds to an app on a
    // platform./*from   w  ww .j  av  a 2 s  .co  m*/
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    System.out.println("\n\n>>>>>>    platformEndpointResult.getEndpointArn()  =  "
            + platformEndpointResult.getEndpointArn() + "\n\n");

    //      String ARN = "arn:aws:sns:us-west-2:043482212558:endpoint/APNS_SANDBOX/Homeroom-Notifications/6c6c1c8e-19be-3a9c-82e4-b5fab2e2a603";
    //      PublishResult publishResult = publish( ARN, platform, attrsMap);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");

    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.mistminds.service.AmazonSNSClientWrapper.java

License:Open Source License

public void demoNotification(Platform platform, String principal, String credential, String platformToken,
        String applicationName, Map<Platform, Map<String, MessageAttributeValue>> attrsMap,
        Map<String, String> pushData) {
    // Create Platform Application. This corresponds to an app on a
    // platform.// w  ww  .  j  a v  a  2 s.  c  o m
    pushData.remove("installationId");
    CreatePlatformApplicationResult platformApplicationResult = createPlatformApplication(applicationName,
            platform, principal, credential);
    System.out.println(platformApplicationResult);

    // The Platform Application Arn can be used to uniquely identify the
    // Platform Application.
    String platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();

    // Create an Endpoint. This corresponds to an app on a device.
    CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform,
            "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
    System.out.println(platformEndpointResult);

    // Publish a push notification to an Endpoint.
    PublishResult publishResult = publish(platformEndpointResult.getEndpointArn(), platform, attrsMap,
            pushData);
    System.out.println("Published! \n{MessageId=" + publishResult.getMessageId() + "}");
    // Delete the Platform Application since we will no longer be using it.
    deletePlatformApplication(platformApplicationArn);
}

From source file:com.netflix.metacat.main.services.notifications.sns.SNSNotificationServiceImpl.java

License:Apache License

private void publishNotification(final String arn, final SNSMessage<?> message)
        throws ExecutionException, RetryException {
    final PublishResult result = this.retry
            .call(() -> this.client.publish(arn, this.mapper.writeValueAsString(message)));
    log.debug("Successfully published message {} to topic {} with id {}", message, arn, result.getMessageId());
}