| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.ksb.messaging; |
| 17 | |
|
| 18 | |
import java.lang.reflect.Method; |
| 19 | |
|
| 20 | |
import org.kuali.rice.core.api.exception.RiceRuntimeException; |
| 21 | |
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
| 22 | |
import org.kuali.rice.ksb.messaging.config.ServiceBasedServiceDefinitionRegisterer; |
| 23 | |
import org.kuali.rice.ksb.service.KSBServiceLocator; |
| 24 | |
|
| 25 | |
|
| 26 | 0 | public class RepeatTopicInvokerQueueImpl extends BaseLifecycle implements RepeatTopicInvokerQueue { |
| 27 | |
|
| 28 | |
private ServiceBasedServiceDefinitionRegisterer defRegisterer; |
| 29 | |
|
| 30 | |
public Object invokeTopic(AsynchronousCall methodCall) { |
| 31 | 0 | ServiceInfo serviceInfo = methodCall.getServiceInfo(); |
| 32 | 0 | Object service = KSBServiceLocator.getMessageHelper().getServiceAsynchronously(serviceInfo.getQname()); |
| 33 | |
try { |
| 34 | 0 | Method method = service.getClass().getMethod(methodCall.getMethodName(), methodCall.getParamTypes()); |
| 35 | 0 | return method.invoke(service, methodCall.getArguments()); |
| 36 | 0 | } catch (Throwable t) { |
| 37 | 0 | throw new RiceRuntimeException("Caught Exception invoking repeatable topic", t); |
| 38 | |
} |
| 39 | |
} |
| 40 | |
|
| 41 | |
public void start() throws Exception { |
| 42 | 0 | this.defRegisterer = new ServiceBasedServiceDefinitionRegisterer("repeatTopicInvokerQueueDefinition"); |
| 43 | 0 | this.defRegisterer.registerServiceDefinition(false); |
| 44 | 0 | setStarted(true); |
| 45 | 0 | } |
| 46 | |
|
| 47 | |
public void stop() throws Exception { |
| 48 | 0 | this.defRegisterer.unregisterServiceDefinition(); |
| 49 | 0 | setStarted(false); |
| 50 | 0 | } |
| 51 | |
} |