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