Consumer-Producer Example |
![]() |
import org.elvin.je4.*;
public class Alert implements NotificationListener {
Producer prod;
private static String expression = "Temp.degrees > 1000";
public void notificationAction(Notification ntfn) {
ntfn.put("Status", "Critical");
ntfn.put("Meltdown.mins", 10);
try {
prod.notify(ntfn);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] argv) throws IOException {
prod = new Producer();
Consumer cons = new Consumer();
Subscription sub = new Subscription(expression, new Alert());
cons.addSubscription(sub);
}
}
|
«» 1 2 3 4 5 6 7 8 9 10 11 12 13 «» |

