Package org.apache.dubbo.metrics.event
Class MetricsEventBus
java.lang.Object
org.apache.dubbo.metrics.event.MetricsEventBus
Dispatches events to listeners, and provides ways for listeners to register themselves.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidafter(MetricsEvent event, Object result) static voidbefore(MetricsEvent event) Applicable to the scene where execution and return are separated, eventSaveRunner saves the event, so that the calculation rt is introvertedstatic voiderror(MetricsEvent event) static <T> Tpost(MetricsEvent event, Supplier<T> targetSupplier) Posts an event to all registered subscribers.static <T> Tpost(MetricsEvent event, Supplier<T> targetSupplier, Function<T, Boolean> trFunction) Full lifecycle post, success and failure conditions can be customizedstatic voidpublish(MetricsEvent event) Posts an event to all registered subscribers and only once.static void
-
Constructor Details
-
MetricsEventBus
public MetricsEventBus()
-
-
Method Details
-
publish
Posts an event to all registered subscribers and only once.- Parameters:
event- event to post.
-
post
Posts an event to all registered subscribers. Full lifecycle post, judging success or failure by whether there is an exception Loop around the event target and return the original processing result- Parameters:
event- event to post.targetSupplier- original processing result targetSupplier
-
post
public static <T> T post(MetricsEvent event, Supplier<T> targetSupplier, Function<T, Boolean> trFunction) Full lifecycle post, success and failure conditions can be customized- Type Parameters:
T- Biz result type- Parameters:
event- event to post.targetSupplier- original processing result suppliertrFunction- Custom event success criteria, judged according to the returned boolean type- Returns:
- Biz result
-
tryInvoke
-
before
Applicable to the scene where execution and return are separated, eventSaveRunner saves the event, so that the calculation rt is introverted -
after
-
error
-