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