mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 02:59:19 +00:00
#113 Event Driven Architecture
- added class diagram - added more comments
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.iluwatar.eda.framework;
|
||||
|
||||
/**
|
||||
* Channels are delivery points for messages.
|
||||
* Every {@link Channel} is responsible for a single type of message
|
||||
*/
|
||||
public interface Channel<E extends Message> {
|
||||
void dispatch(E message);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.iluwatar.eda.framework;
|
||||
|
||||
/**
|
||||
* A {@link DynamicRouter} is responsible for selecting the proper path of a {@link Message}
|
||||
* Messages can be associated to Channels through the registerChannel method and dispatched by calling
|
||||
* the dispatch method.
|
||||
*/
|
||||
public interface DynamicRouter<E extends Message> {
|
||||
void registerChannel(Class<? extends E> contentType, Channel channel);
|
||||
void dispatch(E content);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.iluwatar.eda.framework;
|
||||
|
||||
/**
|
||||
* A {@link Message} is an object with a specific type that is associated to a
|
||||
* specific {@link Channel}
|
||||
*/
|
||||
public interface Message {
|
||||
Class<? extends Message> getType();
|
||||
}
|
||||
Reference in New Issue
Block a user