public class QueryService
extends com.yahoo.bullet.pubsub.PubSubResponder
Constructor and Description |
---|
QueryService(com.yahoo.bullet.storage.StorageManager<com.yahoo.bullet.pubsub.PubSubMessage> storageManager,
List<com.yahoo.bullet.pubsub.PubSubResponder> responders,
List<com.yahoo.bullet.pubsub.Publisher> publishers,
List<com.yahoo.bullet.pubsub.Subscriber> subscribers,
com.yahoo.bullet.pubsub.PubSubMessageSerDe pubSubMessageSendSerDe,
int sleep)
Constructor that takes various necessary components.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Stop all service threads and clear pending requests.
|
CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> |
get(String id)
Retrieves the stored
PubSubMessage of a submitted query. |
CompletableFuture<Void> |
kill(String id)
Submits a
Metadata.Signal#KILL signal to Bullet for the given query ID and removes the query. |
void |
respond(String id,
com.yahoo.bullet.pubsub.PubSubMessage response)
Respond to a
PubSubMessage . |
CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> |
send(com.yahoo.bullet.pubsub.PubSubMessage message)
Sends a
PubSubMessage to Bullet without storing it. |
CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> |
send(String id,
com.yahoo.bullet.pubsub.Metadata.Signal signal)
Sends a
Metadata.Signal to Bullet without storing it. |
CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> |
submit(String id,
com.yahoo.bullet.query.Query query,
String queryString)
Submit a query to Bullet and store it in the storage.
|
public QueryService(com.yahoo.bullet.storage.StorageManager<com.yahoo.bullet.pubsub.PubSubMessage> storageManager, List<com.yahoo.bullet.pubsub.PubSubResponder> responders, List<com.yahoo.bullet.pubsub.Publisher> publishers, List<com.yahoo.bullet.pubsub.Subscriber> subscribers, com.yahoo.bullet.pubsub.PubSubMessageSerDe pubSubMessageSendSerDe, int sleep)
storageManager
- The non-null StorageManager
to use.responders
- The non-empty List
of PubSubResponder
to use.publishers
- The non-empty List
of Publisher
to use.subscribers
- The non-empty List
of Subscriber
to use.pubSubMessageSendSerDe
- The PubSubMessageSerDe
to use for sending messages to the PubSub.sleep
- The time to sleep between checking for messages from the pubsub.public CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> submit(String id, com.yahoo.bullet.query.Query query, String queryString)
id
- The query ID of the query.query
- The query to send.queryString
- The string representation of the query.CompletableFuture
that resolves to the sent PubSubMessage
or null if it could not be sent.public CompletableFuture<Void> kill(String id)
Metadata.Signal#KILL
signal to Bullet for the given query ID and removes the query.id
- The query ID to submit the kill signal for.CompletableFuture
that resolves when the kill was finished.public void respond(String id, com.yahoo.bullet.pubsub.PubSubMessage response)
PubSubMessage
.respond
in class com.yahoo.bullet.pubsub.PubSubResponder
id
- The id of the query.response
- The PubSubMessage
response.public CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> send(String id, com.yahoo.bullet.pubsub.Metadata.Signal signal)
Metadata.Signal
to Bullet without storing it.id
- The non-null ID of the message to send this signal in.signal
- The non-null Metadata.Signal
to send.CompletableFuture
that resolves to the sent PubSubMessage
or null if it could not be sent.public CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> send(com.yahoo.bullet.pubsub.PubSubMessage message)
PubSubMessage
to Bullet without storing it. This can be used to send signals or anything else.message
- The non-null PubSubMessage
to send.CompletableFuture
that resolves to the sent PubSubMessage
or null if it could not be sent.public CompletableFuture<com.yahoo.bullet.pubsub.PubSubMessage> get(String id)
PubSubMessage
of a submitted query.id
- The non-null ID of the query.CompletableFuture
that resolves to the stored PubSubMessage
or null if it could not be found.@PreDestroy public void close()
close
in interface AutoCloseable
close
in class com.yahoo.bullet.pubsub.PubSubResponder
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.