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 @Override
28 public void onApplicationEvent(ApplicationEvent event)
29 {
30 super.onApplicationEvent(event);
31
32 Order order = (Order)event.getSource();
33 String result = processOrder(order);
34
35
36 MuleApplicationEvent muleEvent = (MuleApplicationEvent)event;
37
38
39
40 MuleApplicationEvent returnEvent = null;
41
42 returnEvent = new MuleApplicationEvent(result, "jms://processed.queue");
43
44
45 muleEvent.getApplicationContext().publishEvent(returnEvent);
46 }
47
48 public String processOrder(Order order)
49 {
50
51 return "Order '" + order.getOrder() + "' Processed";
52 }
53
54 public String[] getSubscriptions()
55 {
56 return subscriptions;
57 }
58
59 public void setSubscriptions(String[] subscriptions)
60 {
61 this.subscriptions = subscriptions;
62 }
63
64 }