1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.integration.spring.events.async;
12
13 import org.mule.module.spring.events.MuleApplicationEvent;
14 import org.mule.test.integration.spring.events.Order;
15 import org.mule.test.integration.spring.events.OrderManagerBean;
16
17 import org.springframework.beans.BeansException;
18 import org.springframework.context.ApplicationContext;
19 import org.springframework.context.ApplicationContextAware;
20
21
22
23
24
25 public class AsyncOrderManagerBean extends OrderManagerBean
26 implements AsyncOrderManager, ApplicationContextAware
27 {
28 private ApplicationContext applicationContext;
29
30
31
32
33
34
35
36 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
37 {
38 this.applicationContext = applicationContext;
39 }
40
41
42
43
44
45
46
47 public void processOrderAsync(Order order)
48 {
49
50 String message = "Order '" + order.getOrder() + "' Processed Async";
51 MuleApplicationEvent returnEvent = null;
52 returnEvent = new MuleApplicationEvent(message, "jms://processed.queue");
53
54
55 applicationContext.publishEvent(returnEvent);
56 }
57 }