1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.integration.spring.events;
12
13 import org.mule.module.spring.events.MuleApplicationEvent;
14 import org.mule.module.spring.events.MuleSubscriptionEventListener;
15
16 import org.springframework.context.ApplicationEvent;
17
18
19
20
21
22 public class OrderManagerBean extends TestMuleEventBean
23 implements OrderManager, MuleSubscriptionEventListener
24 {
25 private String[] subscriptions;
26
27 public void onApplicationEvent(ApplicationEvent event)
28 {
29 super.onApplicationEvent(event);
30
31 Order order = (Order)event.getSource();
32 String result = processOrder(order);
33
34
35 MuleApplicationEvent muleEvent = (MuleApplicationEvent)event;
36
37
38
39 MuleApplicationEvent returnEvent = null;
40
41 returnEvent = new MuleApplicationEvent(result, "jms://processed.queue");
42
43
44 muleEvent.getApplicationContext().publishEvent(returnEvent);
45 }
46
47 public String processOrder(Order order)
48 {
49
50 return "Order '" + order.getOrder() + "' Processed";
51 }
52
53 public String[] getSubscriptions()
54 {
55 return subscriptions;
56 }
57
58 public void setSubscriptions(String[] subscriptions)
59 {
60 this.subscriptions = subscriptions;
61 }
62
63 }