1
2
3
4
5
6
7 package org.mule.module.spring.events;
8
9 import org.mule.tck.functional.EventCallback;
10
11 import org.apache.commons.logging.Log;
12 import org.apache.commons.logging.LogFactory;
13 import org.springframework.context.ApplicationEvent;
14 import org.springframework.context.ApplicationListener;
15
16
17
18
19
20
21 public class TestAllEventBean implements MuleEventListener, ApplicationListener
22 {
23 private final Log logger = LogFactory.getLog(this.getClass());
24 private EventCallback eventCallback;
25
26 public void onApplicationEvent(ApplicationEvent event)
27 {
28 logger.debug("Received message: " + event);
29
30 if (eventCallback != null)
31 {
32 try
33 {
34 eventCallback.eventReceived(null, event);
35 }
36 catch (Exception e1)
37 {
38 throw new RuntimeException("Callback failed: " + e1.getMessage(), e1);
39 }
40 }
41 }
42
43 public EventCallback getEventCallback()
44 {
45 return eventCallback;
46 }
47
48 public void setEventCallback(EventCallback eventCallback)
49 {
50 this.eventCallback = eventCallback;
51 }
52
53 }