public class EventBusUtils
extends java.lang.Object
EventBus| Constructor and Description |
|---|
EventBusUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
applyFilters(java.lang.Object event,
java.util.Set<EventFilter> filters,
com.netflix.servo.monitor.StatsTimer filterStats,
java.lang.String invokerDesc,
org.slf4j.Logger logger)
Utility method to apply filters for an event, this can be used both by publisher & subscriber code.
|
static java.lang.Class<?> |
getInterestedEventType(java.lang.Object subscriber,
java.lang.reflect.Method subMethod)
Returns the event class the passed subscriber is interested in.
|
static int |
getQueueSize(SubscriberConfigProvider.SubscriberConfig subscribe)
Returns an appropriate consumer queue size for the passed
subscribe annotation. |
static SubscriberConfigProvider.SubscriberConfig |
getSubscriberConfig(java.lang.reflect.Method subMethod,
java.lang.Object subscriber)
Returns configuration for the passed subscriber method.
|
static SubscriberConfigProvider.SubscriberConfig |
getSubscriberConfig(SubscriberInfo subscriberInfo)
|
static boolean |
isAnEventBatch(java.lang.Object event)
Deduce whether the passed event is an event batch.
|
static com.netflix.servo.monitor.StatsTimer |
newStatsTimer(java.lang.String monitorName,
long collectionDurationInMillis) |
public static int getQueueSize(SubscriberConfigProvider.SubscriberConfig subscribe)
subscribe annotation. This method defaults
the size to the one specified in the fast property EventBus.CONSUMER_QUEUE_SIZE_DEFAULT_PROP_NAMEsubscribe - The annotation for which the queue size is to be retrieved.public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(java.lang.reflect.Method subMethod, java.lang.Object subscriber)
Subscribe annotation on the method or from SubscriberConfigProvider if the subscriber implements
that interface.subscriber - The instance of the subscriber that contains the subscriber method.subMethod - Method for which the configuration has to be found.public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(SubscriberInfo subscriberInfo)
getSubscriberConfig(java.lang.reflect.Method, Object) with
SubscriberInfo.getSubscriberMethod() and
SubscriberInfo.getSubscriberInstance()subscriberInfo - The instance of the subscriber that contains the subscriber method.public static boolean isAnEventBatch(java.lang.Object event)
event - The event to inspect.true if the event is a batch.public static java.lang.Class<?> getInterestedEventType(java.lang.Object subscriber,
java.lang.reflect.Method subMethod)
DynamicSubscriber, in which case the event type will
be as returned by DynamicSubscriber.getEventType().
It is important that the subscriber method is valid as evaluated by
SubscriberValidatorsubscriber - The subscriber instance in question.subMethod - The subscriber method is question.public static boolean applyFilters(java.lang.Object event,
java.util.Set<EventFilter> filters,
com.netflix.servo.monitor.StatsTimer filterStats,
java.lang.String invokerDesc,
org.slf4j.Logger logger)
event - The event to apply filter on.filters - Filters to apply.filterStats - Stats timer for applying the filter.invokerDesc - A string description for the invoker, this is required just for logging.logger - Logger instance to use for logging.true if the event should be processed, false if the event should not be
processed any further i.e. it is filtered out. This will log a debug message when the event is filtered.public static com.netflix.servo.monitor.StatsTimer newStatsTimer(java.lang.String monitorName,
long collectionDurationInMillis)