public interface ProspectiveSearchService
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LEASE_DURATION_SEC
The default lease duration value of zero means no expiration.
|
static int |
DEFAULT_LIST_SUBSCRIPTIONS_MAX_RESULTS |
static int |
DEFAULT_LIST_TOPICS_MAX_RESULTS |
static int |
DEFAULT_RESULT_BATCH_SIZE |
static java.lang.String |
DEFAULT_RESULT_RELATIVE_URL
The default URI path to which matches will be POSTed.
|
static java.lang.String |
DEFAULT_RESULT_TASK_QUEUE_NAME
Uses the default task queue.
|
Modifier and Type | Method and Description |
---|---|
Entity |
getDocument(HttpServletRequest matchCallbackPost)
Decodes document from
#match(Entity, String, String,
String, String, int, bool) result POST request. |
Subscription |
getSubscription(java.lang.String topic,
java.lang.String subId)
Get subscription information.
|
java.util.List<Subscription> |
listSubscriptions(java.lang.String topic)
Equivalent to:
listSubscriptions(topic, "",
DEFAULT_LIST_SUBSCRIPTIONS_MAX_RESULTS,
0);
|
java.util.List<Subscription> |
listSubscriptions(java.lang.String topic,
java.lang.String subIdStart,
int maxResults,
long expiresBefore)
The listSubscriptions call lists subscriptions that are currently
active.
|
java.util.List<java.lang.String> |
listTopics(java.lang.String topicStart,
long maxResults)
List all topics from a given offset to a given limit.
|
void |
match(Entity document,
java.lang.String topic)
Equivalent to:
match(entity, topic, "");
|
void |
match(Entity document,
java.lang.String topic,
java.lang.String resultKey)
Equivalent to:
match(entity, topic, resultKey,
DEFAULT_RESULT_RELATIVE_URL,
DEFAULT_RESULT_TASK_QUEUE_NAME,
DEFAULT_RESULT_BATCH_SIZE,
true);
|
void |
match(Entity document,
java.lang.String topic,
java.lang.String resultKey,
java.lang.String resultRelativeUrl,
java.lang.String resultTaskQueueName,
int resultBatchSize,
boolean resultReturnDocument)
The match call is used to present a document for matching against
all registered subscriptions of the same topic.
|
void |
subscribe(java.lang.String topic,
java.lang.String subId,
long leaseDurationSeconds,
java.lang.String query,
java.util.Map<java.lang.String,FieldType> schema)
The subscribe call is used to register subscriptions, which
comprise of a subscription id and a query.
|
void |
unsubscribe(java.lang.String topic,
java.lang.String subId)
Subscriptions are removed from the system using the unsubscribe
call.
|
static final int DEFAULT_LEASE_DURATION_SEC
static final int DEFAULT_LIST_SUBSCRIPTIONS_MAX_RESULTS
static final int DEFAULT_LIST_TOPICS_MAX_RESULTS
static final int DEFAULT_RESULT_BATCH_SIZE
static final java.lang.String DEFAULT_RESULT_RELATIVE_URL
static final java.lang.String DEFAULT_RESULT_TASK_QUEUE_NAME
void subscribe(java.lang.String topic, java.lang.String subId, long leaseDurationSeconds, java.lang.String query, java.util.Map<java.lang.String,FieldType> schema)
topic
- Specifies the namespace for the
subscription. Subscriptions of a particular topic will only be
matched against documents of the same topic.subId
- Is a unique string for this subscription; subscribe
will overwrite subscriptions with the same subId.query
- Is a query written in the simple query format.leaseDurationSeconds
- Seconds before the subscription is
automatically removed or a value of 0 for no expiration.schema
- Map of schema field names to their corresponding
types.QuerySyntaxException
- raised when query is invalid or does not
match schema.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.void unsubscribe(java.lang.String topic, java.lang.String subId)
topic
- Must be the same as the topic of the subscription to
be removed.subId
- Is the id of the subscription to remove.java.lang.IllegalArgumentException
- if the given topic does not
exist or has no subscription with the given subId.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.void match(Entity document, java.lang.String topic)
match(Entity, String, String)
void match(Entity document, java.lang.String topic, java.lang.String resultKey)
#match(Entity, String, String, String, String, int, bool)
void match(Entity document, java.lang.String topic, java.lang.String resultKey, java.lang.String resultRelativeUrl, java.lang.String resultTaskQueueName, int resultBatchSize, boolean resultReturnDocument)
document
- To match.topic
- Specifies the namespace for the subscriptions to
match. Subscriptions of a particular topic will only be matched
against documents of the same topic.resultKey
- is a user defined key returned with the results
that can be used to associate the result batch with a particular
document.resultRelativeUrl
- is the relative url on which to generate
the http POST event that delivers the result batch.resultTaskQueue
- The TaskQueue to use for delivering results.resultBatchSize
- specifies the maximum number of
subscription ids to put inside one result batch.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.java.util.List<Subscription> listSubscriptions(java.lang.String topic)
java.util.List<Subscription> listSubscriptions(java.lang.String topic, java.lang.String subIdStart, int maxResults, long expiresBefore)
topic
- The topic specified should be the same as that used
in the subscribe call.subIdStart
- Subscriptions which are lexicographically
greater or equal to the given value should be returned. NOTE:
The empty string precedes all others.maxResults
- Sets the maximum number of subscriptions that
should be returned.expiresBefore
- Limits the returned subscriptions to those
that expire before the given time in seconds since epoch, or 0
for no expiration.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.Subscription getSubscription(java.lang.String topic, java.lang.String subId)
topic
- The associated topic.subId
- The subscription ID to lookup.null
if the specified
subscription does not exist.IllegalArgumentExcpetion
- Subscription with specified id
does not exist.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.java.util.List<java.lang.String> listTopics(java.lang.String topicStart, long maxResults)
topicStart
- The topic from which to start listing.maxResults
- The maximum number of topics to return. A good
default is 1000.ApiProxy.ApplicationException
- Call failed. See the
message detail for the reason.Entity getDocument(HttpServletRequest matchCallbackPost)
#match(Entity, String, String,
String, String, int, bool)
result POST request.matchCallbackPost
- The received POST request.