-
Notifications
You must be signed in to change notification settings - Fork 12
/
SqsProperties.java
45 lines (34 loc) · 1016 Bytes
/
SqsProperties.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.craftingjava.examples.jms.sqs;
import java.net.URI;
import java.util.Optional;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Created by lcsontos on 8/4/17.
*/
@Data
@ConfigurationProperties(prefix = "amazon.sqs")
public class SqsProperties {
private String region;
private String endpoint;
private String accessKey;
private String secretKey;
private Integer numberOfMessagesToPrefetch;
private Extended extended = new Extended();
public Optional<Integer> getNumberOfMessagesToPrefetch() {
return Optional.ofNullable(numberOfMessagesToPrefetch);
}
public String getQueueName() {
URI endpointUri = URI.create(endpoint);
String path = endpointUri.getPath();
int pos = path.lastIndexOf('/');
return path.substring(pos + 1);
}
@Data
public static class Extended {
private String s3Region;
private String s3BucketName;
private String s3AccessKey;
private String s3SecretKey;
}
}