Package gov.usgs.earthquake.aws
Class ProductsCreatedAfterClient
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.aws.ProductsCreatedAfterClient
- All Implemented Interfaces:
Configurable
Client to encapsulate REST interactions with server providing
`products_created_after` information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static property stringprotected int
settable internal batch limitstatic final String
Property key for connect timeout propertyprotected long
static final String
static property default valuestatic final String
static property default URLprotected HttpClient
static Logger
Logger to log across instancesstatic final String
Property key for max retry attempts propertyprotected int
static final String
Property key for read timeout propertyprotected long
protected List<AwsProductReceiver>
list of aws product receiversstatic final String
The template for making REST requests.protected String
URL template string -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addReceiver
(AwsProductReceiver receiver) Add the given receiver as a listener to be notified of messages.void
Process configuration settings.int
GetterGetterGettervoid
notify
(javax.json.JsonObject message) Notify current receives with the message.void
onResponse
(javax.json.JsonObject json, long durationMs, Instant createdAfter) Called on success within the running async task.void
removeReceiver
(AwsProductReceiver receiver) Remove a receiver from the list of currently configured receiversvoid
Send an async Http requestvoid
setBatchLimit
(int batchLimit) Settervoid
setHttpClient
(HttpClient httpClient) Settervoid
setUrlTemplate
(String urlTemplate) SetterMethods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName, shutdown, startup
-
Field Details
-
LOGGER
Logger to log across instances -
BATCH_LIMIT_PROPERTY
static property string- See Also:
-
URL_TEMPLATE_PROPERTY
The template for making REST requests. This URL supports the following replacement strings: - {CREATED_AFTER} - {BATCH_LIMIT}- See Also:
-
DEFAULT_BATCH_LIMIT
static property default value- See Also:
-
DEFAULT_URL_TEMPLATE
static property default URL- See Also:
-
CONNECT_TIMEOUT_PROPERTY
Property key for connect timeout property- See Also:
-
READ_TIMEOUT_PROPERTY
Property key for read timeout property- See Also:
-
MAX_RETRY_ATTEMPTS_PROPERTY
Property key for max retry attempts property- See Also:
-
batchLimit
protected int batchLimitsettable internal batch limit -
httpClient
-
connectTimeout
protected long connectTimeout -
readTimeout
protected long readTimeout -
maxRetryAttempts
protected int maxRetryAttempts -
receivers
list of aws product receivers -
urlTemplate
URL template string
-
-
Constructor Details
-
ProductsCreatedAfterClient
public ProductsCreatedAfterClient()default constructor
-
-
Method Details
-
addReceiver
Add the given receiver as a listener to be notified of messages.- Parameters:
receiver
- aws product receiver
-
configure
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultConfigurable
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
getBatchLimit
public int getBatchLimit()Getter- Returns:
- my batch limit as an int
-
getUrlTemplate
Getter- Returns:
- my url template as a string
-
notify
public void notify(javax.json.JsonObject message) Notify current receives with the message.- Parameters:
message
- json formatted message
-
onResponse
Called on success within the running async task. Parses the raw response and notifies configured receivers about each message in the raw payload.- Parameters:
json
- json formatted messagedurationMs
- duration in millisecondscreatedAfter
- single point in time
-
removeReceiver
Remove a receiver from the list of currently configured receivers- Parameters:
receiver
- aws product receiver
-
send
Send an async Http request- Parameters:
createdAfter
- Instant to retrieve products after- Throws:
URISyntaxException
- thrown if an invalid URI is created
-
setBatchLimit
public void setBatchLimit(int batchLimit) Setter- Parameters:
batchLimit
- integer indicating what my batch limit should be set to
-
setUrlTemplate
Setter- Parameters:
urlTemplate
- a string representing what my url template should be set to
-
setHttpClient
Setter- Parameters:
httpClient
- an HttpClient used to send requests and receive responses
-
getHttpClient
Getter
-