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 Stringstatic property stringprotected intsettable internal batch limitstatic final StringProperty key for connect timeout propertyprotected longstatic final Stringstatic property default valuestatic final Stringstatic property default URLprotected HttpClientstatic LoggerLogger to log across instancesstatic final StringProperty key for max retry attempts propertyprotected intstatic final StringProperty key for read timeout propertyprotected longprotected List<AwsProductReceiver>list of aws product receiversstatic final StringThe template for making REST requests.protected StringURL template string -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReceiver(AwsProductReceiver receiver) Add the given receiver as a listener to be notified of messages.voidProcess configuration settings.intGetterGetterGettervoidnotify(javax.json.JsonObject message) Notify current receives with the message.voidonResponse(javax.json.JsonObject json, long durationMs, Instant createdAfter) Called on success within the running async task.voidremoveReceiver(AwsProductReceiver receiver) Remove a receiver from the list of currently configured receiversvoidSend an async Http requestvoidsetBatchLimit(int batchLimit) SettervoidsetHttpClient(HttpClient httpClient) SettervoidsetUrlTemplate(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:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein 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
-