1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.ksb.messaging.callforwarding; |
18 | |
|
19 | |
import java.sql.Timestamp; |
20 | |
|
21 | |
import org.apache.log4j.Logger; |
22 | |
import org.kuali.rice.core.util.RiceUtilities; |
23 | |
import org.kuali.rice.ksb.messaging.AsynchronousCall; |
24 | |
import org.kuali.rice.ksb.messaging.PersistedMessagePayload; |
25 | |
import org.kuali.rice.ksb.messaging.PersistedMessage; |
26 | |
import org.kuali.rice.ksb.messaging.serviceproxies.MessageSender; |
27 | |
import org.kuali.rice.ksb.service.KSBServiceLocator; |
28 | |
import org.kuali.rice.ksb.util.KSBConstants; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public class ForwardedCallHandlerImpl implements ForwardedCallHandler { |
35 | |
|
36 | 0 | private static final Logger LOG = Logger.getLogger(ForwardedCallHandlerImpl.class); |
37 | |
|
38 | |
public void handleCall(PersistedMessage message) throws Exception { |
39 | 0 | LOG.debug("Recieved forwared message from service " + message.getMethodCall().getServiceInfo().getQname()); |
40 | 0 | PersistedMessage copy = new PersistedMessage(); |
41 | 0 | copy.setExpirationDate(message.getExpirationDate()); |
42 | 0 | copy.setIpNumber(RiceUtilities.getIpNumber()); |
43 | 0 | copy.setServiceNamespace(message.getServiceNamespace()); |
44 | 0 | copy.setMethodCall(message.getMethodCall()); |
45 | 0 | copy.setMethodName(message.getMethodName()); |
46 | 0 | copy.setQueueDate(new Timestamp(System.currentTimeMillis())); |
47 | 0 | copy.setQueuePriority(message.getQueuePriority()); |
48 | 0 | copy.setQueueStatus(KSBConstants.ROUTE_QUEUE_QUEUED); |
49 | 0 | copy.setRetryCount(message.getRetryCount()); |
50 | 0 | AsynchronousCall methodCall = message.getPayload().getMethodCall(); |
51 | 0 | methodCall.setIgnoreStoreAndForward(true); |
52 | 0 | copy.setPayload(new PersistedMessagePayload(methodCall, copy)); |
53 | 0 | copy.setServiceName(message.getServiceName()); |
54 | 0 | message.setQueueStatus(KSBConstants.ROUTE_QUEUE_ROUTING); |
55 | 0 | KSBServiceLocator.getRouteQueueService().save(message); |
56 | 0 | MessageSender.sendMessage(message); |
57 | 0 | } |
58 | |
} |