01: /*
02: @COPYRIGHT@
03: */
04: package demo.events;
05:
06: import java.util.Date;
07: import org.springframework.context.ApplicationContext;
08: import org.springframework.context.ApplicationEvent;
09:
10: /**
11: * Simple message event, this will be distributed by Terracotta for Spring and sent to each of the nodes in the cluster
12: * whenever this event is sent via the {@link ApplicationContext#publishEvent(ApplicationEvent)} method.
13: */
14: public class MessageEvent extends ApplicationEvent {
15: private final String message;
16:
17: public MessageEvent(Object source, String message) {
18: super (source);
19: this .message = message;
20: }
21:
22: public String getMessage() {
23: return message;
24: }
25:
26: public Date getDate() {
27: return new Date(getTimestamp());
28: }
29:
30: public String toString() {
31: return message;
32: }
33: }
|