Skip to content

Event loop for processing your Java based application events

Notifications You must be signed in to change notification settings

alexpractice/event-loop-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Loop

Simple event loop for processing custom application events

#####1. Configure Event Publisher and Event Loop.

EventBus eventBus = new EventBusImpl();
EventLoop eventLoop = new EventLoopImpl(eventBus);
EventPublisher eventPublisher = new EventPublisherImpl(eventBus);

eventLoop.addEventHandler(simpleEventHandler);
eventLoop.addEventHandler(urlCheckingEventHandler);
eventLoop.addEventHandler(isOddNumberResultEventHandler);
eventLoop.addEventHandler(isOddNumberCheckingEventHandler);

#####2. Start Event Loop after configuring

eventLoop.start();

#####3. Publish events through the Event Publisher

SimpleEvent simpleEvent = new SimpleEvent("hello world!");
eventPublisher.publish(simpleEvent);

You may see the working example into Test.java

I'll publish thats event-loop library in maven central repository later