Builder for TraverserConfiguration class.
Optional configuration parameters:
traverser.pollRequest.queue- Specifies the queue names that this traverser polls. Default: Empty string (implies "default")traverser.pollRequest.statuses- Specifies the specific item status' that this traverser polls. Default: Empty string (implies all status values)traverser.pollRequest.limit- Specifies the maximum number of items to return from a polling request. Default: 0 (implies API maximum)traverser.timeout- Specifies the timeout value for interrupting this traverser poll attempt. Default:60traverser.timeunit- Specifies the timeout units. Default: SECONDStraverser.hostload- Specifies the maximum number of active parallel threads available for polling. Default:5
Constant Summary
| String | CONFIG_HOSTLOAD | |
| int | CONFIG_HOSTLOAD_DEFAULT | |
| String | CONFIG_POLL_REQUEST_LIMIT | |
| String | CONFIG_POLL_REQUEST_QUEUE | |
| String | CONFIG_POLL_REQUEST_STATUSES | |
| String | CONFIG_TIMEOUT | |
| int | CONFIG_TIMEOUT_DEFAULT | |
| String | CONFIG_TIMEUNIT | |
| String | TRAVERSER |
Public Constructor Summary
|
TraverserConfiguration.Builder()
Creates a builder instance with default configuration properties.
|
|
|
TraverserConfiguration.Builder(String configKey)
Creates the builder instance and populates the configuration properties using
configKey as follows:
This example indicates that we should scale the traverser up to 10 parallel polling threads and set the timeout to 20 seconds. |
Public Method Summary
| TraverserConfiguration |
build()
Builds a
TraverserConfiguration instance. |
| TraverserConfiguration.Builder |
hostLoad(int hostLoad)
Sets hostload (number of worker threads) used by
TraverserWorker |
| TraverserConfiguration.Builder |
itemRetriever(ItemRetriever itemRetriever)
Sets the
ItemRetriever to use for processing poll queue items. |
| TraverserConfiguration.Builder |
itemRetriever(BatchItemRetriever batchItemRetriever)
Sets
BatchItemRetriever to use for processing poll queue items. |
| TraverserConfiguration.Builder |
name(String name)
Sets the name of the worker thread that can be used for logging.
|
| TraverserConfiguration.Builder |
pollRequest(PollItemsRequest pollRequest)
Sets the
PollItemsRequest that is used to poll queue items. |
Inherited Method Summary
Constants
public static final String CONFIG_HOSTLOAD
public static final int CONFIG_HOSTLOAD_DEFAULT
public static final String CONFIG_POLL_REQUEST_LIMIT
public static final String CONFIG_POLL_REQUEST_QUEUE
public static final String CONFIG_POLL_REQUEST_STATUSES
public static final String CONFIG_TIMEOUT
public static final int CONFIG_TIMEOUT_DEFAULT
public static final String CONFIG_TIMEUNIT
public static final String TRAVERSER
Public Constructors
public TraverserConfiguration.Builder ()
Creates a builder instance with default configuration properties.
The default configuration properties can be overridden:
traverser.pollRequest.queue=defaulttraverser.pollRequest.statuses=traverser.pollRequest.limit=0traverser.tiemout=60traverser.timeunit=SECONDStraverser.hostload=5
public TraverserConfiguration.Builder (String configKey)
Creates the builder instance and populates the configuration properties using
configKey as follows:
traverser.[configKey].pollRequest.queue=QueueNametraverser.[configKey].pollRequest.statuses=NEW_ITEM,MODIFIEDtraverser.[configKey].pollRequest.limit=30traverser.[configKey].timeout=20traverser.[configKey].timeunit=SECONDStraverser.[configKey].hostload=10
This example indicates that we should scale the traverser up to 10 parallel polling threads and set the timeout to 20 seconds. Worker threads use the queue "QueueName" and poll requests with statuses of only "NEW_ITEM" or "MODIFIED".
If configuration parameters with [configKey] are missing, the default parameters are applied:
traverser.pollRequest.queue=defaulttraverser.pollRequest.statuses=traverser.pollRequest.limit=0traverser.tiemout=60traverser.timeunit=SECONDStraverser.hostload=5
The default configuration properties can also be overridden.
Parameters
| configKey | the custom configuration key name (see example above) |
|---|
Public Methods
public TraverserConfiguration build ()
Builds a TraverserConfiguration instance.
Returns
- the fully formed
TraverserConfigurationinstance
public TraverserConfiguration.Builder hostLoad (int hostLoad)
Sets hostload (number of worker threads) used by TraverserWorker
Parameters
| hostLoad | number of worker threads ised by traverser worker |
|---|
Returns
- this builder
public TraverserConfiguration.Builder itemRetriever (ItemRetriever itemRetriever)
Sets the ItemRetriever to use for processing poll queue items.
Only one of ItemRetriever or BatchItemRetriever can be defined in a
TraverserConfiguration instance.
Parameters
| itemRetriever | the item retriever object |
|---|
Returns
- this builder
public TraverserConfiguration.Builder itemRetriever (BatchItemRetriever batchItemRetriever)
Sets BatchItemRetriever to use for processing poll queue items.
Only one of ItemRetriever or BatchItemRetriever can be defined in a
TraverserConfiguration instance.
Parameters
| batchItemRetriever | the item retriever object |
|---|
Returns
- this builder
public TraverserConfiguration.Builder name (String name)
Sets the name of the worker thread that can be used for logging.
Parameters
| name | the name of the worker thread |
|---|
Returns
- this builder
public TraverserConfiguration.Builder pollRequest (PollItemsRequest pollRequest)
Sets the PollItemsRequest that is used to poll queue items.
Parameters
| pollRequest | the pollRequest object |
|---|
Returns
- this builder