128.6. 消耗多种事件

为了定义由 Guava EventBus consumer 使用 监听器 端点选项消耗的多种事件类型,因为监听程序接口可能会提供标有 @Subscribe 注释的多种方法。

package com.example;

public interface MultipleEventsListener {

  @Subscribe
  void someEventReceived(SomeEvent event);

  @Subscribe
  void anotherEventReceived(AnotherEvent event);

}

上方出现的监听程序可以在端点定义中使用,如下所示:

from("guava-eventbus:busName?listenerInterface=com.example.MultipleEventsListener").to("seda:queue");