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
15
16
17
18
19
20 public class TestMuleEventBean implements MuleEventListener
21 {
22 private final Log logger = LogFactory.getLog(this.getClass());
23 private EventCallback eventCallback;
24
25 public void onApplicationEvent(ApplicationEvent event)
26 {
27 MuleApplicationEvent e = (MuleApplicationEvent)event;
28
29 logger.debug("Received message on: " + e.getEndpoint());
30
31 if (eventCallback != null)
32 {
33 try
34 {
35 eventCallback.eventReceived(e.getMuleEventContext(), event);
36 }
37 catch (Exception e1)
38 {
39 throw new RuntimeException("Callback failed: " + e1.getMessage(), e1);
40 }
41 }
42 }
43
44 public EventCallback getEventCallback()
45 {
46 return eventCallback;
47 }
48
49 public void setEventCallback(EventCallback eventCallback)
50 {
51 this.eventCallback = eventCallback;
52 }
53
54 }