P - Type of payload received.T - Type of concrete manager, needed for fluent methods.public abstract class AbstractSubscriberManager<P,T extends ISubscriberManager<P,T>> extends FugueLifecycleComponent<T> implements ISubscriberManager<P,T>
| Modifier and Type | Field and Description |
|---|---|
protected static long |
FAILED_CONSUMER_RETRY_TIME |
protected static long |
FAILED_DEAD_LETTER_RETRY_TIME |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSubscriberManager(Class<T> type,
ITraceContextFactory traceFactory,
IThreadSafeErrorConsumer<P> unprocessableMessageConsumer) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertConfigurable() |
protected List<Subscription<P>> |
getSubscribers() |
protected ITraceContextFactory |
getTraceFactory() |
long |
handleMessage(IThreadSafeRetryableConsumer<P> consumer,
P payload,
ITraceContext trace)
Handle the given message.
|
protected void |
setLifeCycleState(FugueLifecycleState arg0) |
void |
start() |
protected abstract void |
startSubscription(Subscription<P> subscription) |
void |
stop() |
protected abstract void |
stopSubscriptions()
Stop all subscribers.
|
T |
withSubscription(String topicName,
String subscriptionName,
IThreadSafeRetryableConsumer<P> consumer)
Add the given subscription.
|
T |
withSubscriptionsByConfig(List<String> topicNames,
String subscriptionName,
IThreadSafeRetryableConsumer<P> consumer)
Subscribe to the given subscription on the given topic.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetComponentId, getComponentState, getComponentStatusMessageprotected static final long FAILED_DEAD_LETTER_RETRY_TIME
protected static final long FAILED_CONSUMER_RETRY_TIME
protected AbstractSubscriberManager(Class<T> type, ITraceContextFactory traceFactory, IThreadSafeErrorConsumer<P> unprocessableMessageConsumer)
public T withSubscription(String topicName, String subscriptionName, IThreadSafeRetryableConsumer<P> consumer)
ISubscriberManagerwithSubscription in interface ISubscriberManager<P,T extends ISubscriberManager<P,T>>topicName - A topic namesubscriptionName - A subscription nameconsumer - The consumer for received messages.public T withSubscriptionsByConfig(List<String> topicNames, String subscriptionName, IThreadSafeRetryableConsumer<P> consumer)
ISubscriberManagerwithSubscriptionsByConfig in interface ISubscriberManager<P,T extends ISubscriberManager<P,T>>topicNames - A list of topic names.subscriptionName - A subscription name.consumer - A consumer for received messages.protected abstract void startSubscription(Subscription<P> subscription)
protected abstract void stopSubscriptions()
protected ITraceContextFactory getTraceFactory()
protected List<Subscription<P>> getSubscribers()
public void start()
start in interface IFugueComponentpublic void stop()
stop in interface IFugueComponentpublic long handleMessage(IThreadSafeRetryableConsumer<P> consumer, P payload, ITraceContext trace)
consumer - The consumer for the message.payload - A received message.trace - A trace context.protected void assertConfigurable()
protected void setLifeCycleState(FugueLifecycleState arg0)
Copyright © 2018 Symphony Software Foundation. All rights reserved.