Java Code Examples for com.google.common.eventbus.AsyncEventBus#register()

The following examples show how to use com.google.common.eventbus.AsyncEventBus#register() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AsyncTaskProduceClient.java    From oneplatform with Apache License 2.0 5 votes vote down vote up
private AsyncTaskProduceClient() {
	try {			
		topicProducer = InstanceFactory.getInstance(TopicProducerSpringProvider.class);
	} catch (Exception e) {}
	
	if(topicProducer == null){
		executorService = Executors.newFixedThreadPool(2,new StandardThreadFactory("async-event-executor"));
		asyncEventBus = new AsyncEventBus(executorService);
		Collection<MessageHandler> handlers = InstanceFactory.getInstanceProvider().getInterfaces(MessageHandler.class).values();
		for (MessageHandler messageHandler : handlers) {
			asyncEventBus.register(messageHandler);
		}
	}
}
 
Example 2
Source File: SchedulerMonitor.java    From jeesuite-libs with Apache License 2.0 5 votes vote down vote up
public SchedulerMonitor(String registryType, String servers) {
	if("zookeeper".equals(registryType)) {
		ZkConnection zkConnection = new ZkConnection(servers);
		zkClient = new ZkClient(zkConnection, 3000);
	}else{
		asyncEventBus = new AsyncEventBus(JobContext.getContext().getSyncExecutor());
		asyncEventBus.register(JobContext.getContext().getRegistry());
	}
}
 
Example 3
Source File: SubscriptionSender.java    From jivejdon with Apache License 2.0 4 votes vote down vote up
public SubscriptionSender(SubscriptionNotify subscriptionNotify, ScheduledExecutorUtil scheduledExecutorUtil) {
	eventBus = new AsyncEventBus(scheduledExecutorUtil.getScheduExec());
	eventBus.register(subscriptionNotify);
}
 
Example 4
Source File: ShortMessageHandler.java    From jivejdon with Apache License 2.0 4 votes vote down vote up
public ShortMessageHandler(ShortMessageFactory factory, ScheduledExecutorUtil scheduledExecutorUtil) {
	super();
	this.factory = factory;
	eventBus = new AsyncEventBus(scheduledExecutorUtil.getScheduExec());
	eventBus.register(this);
}
 
Example 5
Source File: NewMessageNotifier.java    From jivejdon with Apache License 2.0 4 votes vote down vote up
public NewMessageNotifier(Lobby lobby, BlogPingClient blogPingClient, ScheduledExecutorUtil scheduledExecutorUtil) {
	super();
	this.lobby = lobby;
	eventBus = new AsyncEventBus(scheduledExecutorUtil.getScheduExec());
	eventBus.register(blogPingClient);
}
 
Example 6
Source File: EmailHelper.java    From jivejdon with Apache License 2.0 4 votes vote down vote up
public EmailHelper(EmailSender emailSender, ScheduledExecutorUtil scheduledExecutorUtil) {
	eventBus = new AsyncEventBus(scheduledExecutorUtil.getScheduExec());
	eventBus.register(emailSender);
}
 
Example 7
Source File: EventBusStart.java    From tools-journey with Apache License 2.0 4 votes vote down vote up
private static void async() {
    final AsyncEventBus asyncEventBus = new AsyncEventBus(Executors.newCachedThreadPool());
    asyncEventBus.register(new CommonListener());
    asyncEventBus.post(new ChargeEvent());
}
 
Example 8
Source File: TestGenericSubscribe.java    From kamike.divide with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TestGenericSubscribe(AsyncEventBus asyncEventBus) {
    asyncEventBus.register(this);
}