@Service
public class HandlerService
extends com.yahoo.bullet.pubsub.PubSubResponder
QueryHandler
instances.Constructor and Description |
---|
HandlerService()
Constructor that creates a responder.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(String id,
QueryHandler handler)
Adds the given
QueryHandler for the given ID to this service. |
void |
close()
Stop all service threads and clear pending handlers.
|
int |
count()
Get the number of running handlers.
|
void |
failAllHandlers()
Clears all pending handlers.
|
boolean |
failHandler(String id)
Fail a given handler, if it exists.
|
QueryHandler |
getHandler(String id)
Retrieves the
QueryHandler for the given ID, if it exists. |
boolean |
hasHandler(String id)
Checks to see if a given handler exists.
|
QueryHandler |
removeHandler(String id)
Removes a
QueryHandler for the given ID. |
void |
respond(String id,
com.yahoo.bullet.pubsub.PubSubMessage message) |
@Autowired public HandlerService()
public void respond(String id, com.yahoo.bullet.pubsub.PubSubMessage message)
respond
in class com.yahoo.bullet.pubsub.PubSubResponder
public void addHandler(String id, QueryHandler handler)
QueryHandler
for the given ID to this service.id
- The ID of the handler.handler
- The QueryHandler
instance to add.public QueryHandler getHandler(String id)
QueryHandler
for the given ID, if it exists.id
- The ID of the handler.QueryHandler
instance or null if the handler does not exist.public QueryHandler removeHandler(String id)
QueryHandler
for the given ID.id
- The ID of the handler.QueryHandler
instance or null if the handler does not exist.public boolean hasHandler(String id)
id
- The ID of the handler.public boolean failHandler(String id)
QueryHandler.fail()
method.id
- The ID of a handler to fail, if it exists.public void failAllHandlers()
public int count()
@PreDestroy public void close()
close
in interface AutoCloseable
close
in class com.yahoo.bullet.pubsub.PubSubResponder
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.