public abstract class AbstractSubscriberManager<P,T extends AbstractSubscriberManager<P,T>> extends FugueLifecycleComponent<T>
| Modifier and Type | Field and Description |
|---|---|
protected static long |
FAILED_CONSUMER_RETRY_TIME |
protected static long |
FAILED_DEAD_LETTER_RETRY_TIME |
| Constructor and Description |
|---|
AbstractSubscriberManager(Class<T> type,
ITraceContextFactory traceFactory,
IThreadSafeRetryableConsumer<P> consumer,
IThreadSafeConsumer<P> unprocessableMessageConsumer) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertConfigurable() |
protected ITraceContextFactory |
getTraceFactory() |
long |
handleMessage(P immutableByteArray,
ITraceContext trace)
Handle the given message.
|
protected T |
self() |
protected void |
setLifeCycleState(FugueLifecycleState arg0) |
void |
start() |
protected abstract void |
startSubscriptions(Map<String,Set<String>> subscriptionsByTopic,
Map<String,Set<String>> topicsBySubscription)
Start with the given subscriptions.
|
void |
stop() |
protected abstract void |
stopSubscriptions()
Stop all subscribers.
|
protected void |
transitionTo(FugueLifecycleState arg0) |
T |
withSubscription(String topicName,
String subscriptionName)
Subscribe to the given subscription on the given topic.
|
protected static final long FAILED_DEAD_LETTER_RETRY_TIME
protected static final long FAILED_CONSUMER_RETRY_TIME
public AbstractSubscriberManager(Class<T> type, ITraceContextFactory traceFactory, IThreadSafeRetryableConsumer<P> consumer, IThreadSafeConsumer<P> unprocessableMessageConsumer)
public T withSubscription(String topicName, String subscriptionName)
topicName - The name of the topic to subscribe to.subscriptionName - The name of the subscription to subscribe to.IllegalArgumentException - If a duplicate request is made.protected abstract void startSubscriptions(Map<String,Set<String>> subscriptionsByTopic, Map<String,Set<String>> topicsBySubscription)
subscriptionsByTopic - A map of topic names, each entry is a set of subscription names.topicsBySubscription - A map of subscription names, each entry is a set of topic names.protected abstract void stopSubscriptions()
protected ITraceContextFactory getTraceFactory()
public final void start()
public final void stop()
public long handleMessage(P immutableByteArray, ITraceContext trace)
immutableByteArray - A received message.trace - A trace context.protected T self()
protected void assertConfigurable()
protected void transitionTo(FugueLifecycleState arg0)
protected void setLifeCycleState(FugueLifecycleState arg0)
Copyright © 2018 Symphony Software Foundation. All rights reserved.