com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient Java Examples

The following examples show how to use com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmailService.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * Inits the.
 */
public void init() {
    if (this.awsAccessKey == null) {
        this.awsAccessKey = System.getenv("AWS_ACCESS_KEY");
        if (this.awsAccessKey == null) {
            this.awsAccessKey = System.getProperty("com.oneops.aws.accesskey");
        }
    }

    if (this.awsSecretKey == null) {
        this.awsSecretKey = System.getenv("AWS_SECRET_KEY");
        if (this.awsSecretKey == null) {
            this.awsSecretKey = System.getProperty("com.oneops.aws.secretkey");
        }
    }

    emailClient = new AmazonSimpleEmailServiceClient(
            new BasicAWSCredentials(awsAccessKey, awsSecretKey));
}
 
Example #2
Source File: MailSenderAutoConfiguration.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingAmazonClient(AmazonSimpleEmailService.class)
public AmazonWebserviceClientFactoryBean<AmazonSimpleEmailServiceClient> amazonSimpleEmailService(
		AWSCredentialsProvider credentialsProvider) {
	return new AmazonWebserviceClientFactoryBean<>(
			AmazonSimpleEmailServiceClient.class, credentialsProvider,
			this.regionProvider);
}
 
Example #3
Source File: SESIntegrationTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Test
public void sendSimpleMessage() throws Exception {

    AmazonSimpleEmailServiceClient sesClient = provider.getClient();
    Assume.assumeNotNull("AWS client not null", sesClient);

    WildFlyCamelContext camelctx = new WildFlyCamelContext();
    camelctx.getNamingContext().bind("sesClient", sesClient);

    camelctx.addRoutes(new RouteBuilder() {
        public void configure() {
            from("direct:start")
            .to("aws-ses://" + SESUtils.FROM + "?amazonSESClient=#sesClient");
        }
    });

    camelctx.start();
    try {
        Exchange exchange = ExchangeBuilder.anExchange(camelctx)
                .withHeader(SesConstants.SUBJECT, SESUtils.SUBJECT)
                .withHeader(SesConstants.TO, Collections.singletonList(SESUtils.TO))
                .withBody("Hello world!")
                .build();

        ProducerTemplate producer = camelctx.createProducerTemplate();
        Exchange result = producer.send("direct:start", exchange);

        String messageId = result.getIn().getHeader(SesConstants.MESSAGE_ID, String.class);
        Assert.assertNotNull("MessageId not null", messageId);

    } finally {
        camelctx.close();
    }
}
 
Example #4
Source File: SESUtils.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
public static AmazonSimpleEmailServiceClient createEmailClient() {
    BasicCredentialsProvider credentials = BasicCredentialsProvider.standard();
    AmazonSimpleEmailServiceClient client = !credentials.isValid() ? null : (AmazonSimpleEmailServiceClient)
            AmazonSimpleEmailServiceClientBuilder.standard()
            .withCredentials(credentials)
            .withRegion("eu-west-1")
            .build();
    return client;
}
 
Example #5
Source File: Handler.java    From Building-Serverless-Architectures with MIT License 4 votes vote down vote up
@Inject
public Handler setSimpleEmailServiceClient(
        AmazonSimpleEmailServiceClient simpleEmailServiceClient) {
    this.simpleEmailServiceClient = simpleEmailServiceClient;
    return this;
}
 
Example #6
Source File: Handler.java    From Building-Serverless-Architectures with MIT License 4 votes vote down vote up
@Inject
public Handler setSimpleEmailServiceClient(
    AmazonSimpleEmailServiceClient simpleEmailServiceClient) {
  this.simpleEmailServiceClient = simpleEmailServiceClient;
  return this;
}
 
Example #7
Source File: Handler.java    From Building-Serverless-Architectures with MIT License 4 votes vote down vote up
@Inject
public Handler setSimpleEmailServiceClient(
        AmazonSimpleEmailServiceClient simpleEmailServiceClient) {
    this.simpleEmailServiceClient = simpleEmailServiceClient;
    return this;
}
 
Example #8
Source File: Handler.java    From Building-Serverless-Architectures with MIT License 4 votes vote down vote up
@Inject
public Handler setSimpleEmailServiceClient(
        AmazonSimpleEmailServiceClient simpleEmailServiceClient) {
    this.simpleEmailServiceClient = simpleEmailServiceClient;
    return this;
}
 
Example #9
Source File: SESClientProducer.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
SESClientProvider(AmazonSimpleEmailServiceClient client) {
    this.client = client;
}
 
Example #10
Source File: SESClientProducer.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
public AmazonSimpleEmailServiceClient getClient() {
    return client;
}
 
Example #11
Source File: SESClientProducer.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Produces
@Singleton
public SESClientProvider getClientProvider() throws Exception {
    AmazonSimpleEmailServiceClient client = SESUtils.createEmailClient();
    return new SESClientProvider(client);
}