Example usage for org.springframework.jms.remoting JmsInvokerServiceExporter setServiceInterface

List of usage examples for org.springframework.jms.remoting JmsInvokerServiceExporter setServiceInterface

Introduction

In this page you can find the example usage for org.springframework.jms.remoting JmsInvokerServiceExporter setServiceInterface.

Prototype

public void setServiceInterface(Class<?> serviceInterface) 

Source Link

Document

Set the interface of the service to export.

Usage

From source file:org.nebulaframework.util.jms.JMSRemotingSupport.java

/**
 * Remote enables a given object as a remote JMS Service
 * through a given Service Interface.//ww  w  .j ava  2s.  co m
 * 
 * @param <T> Type of Service Interface
 * @param cf JMS Connection Factory
 * @param queueName Name of JMS Queue used for communication
 * @param service Service object to be remote enabled
 * @param serviceClass Service Interface Class
 * @return Message Listener Container
 */
public static <T> DefaultMessageListenerContainer createService(ConnectionFactory cf, String queueName,
        T service, Class<T> serviceClass) {

    ActiveMQQueue queue = new ActiveMQQueue(queueName);

    // Export Service
    JmsInvokerServiceExporter exporter = new JmsInvokerServiceExporter();
    exporter.setServiceInterface(serviceClass);
    exporter.setService(service);
    exporter.afterPropertiesSet();

    // Set up MessageListenerContainer
    DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
    container.setConnectionFactory(cf);
    container.setDestination(queue);
    container.setMessageListener(exporter);
    container.afterPropertiesSet();

    return container;
}

From source file:com.jim.im.config.GenericMQConfig.java

/**
 * RPC??/*from w w  w.j  a  v  a 2s.  co  m*/
 * 
 * @param rpcService ?
 * @param rpcServiceInterfaceClazz
 * @return
 */
protected JmsInvokerServiceExporter buildRpcServiceExport(Object rpcService,
        Class<?> rpcServiceInterfaceClazz) {
    JmsInvokerServiceExporter export = new JmsInvokerServiceExporter();
    export.setServiceInterface(rpcServiceInterfaceClazz);
    export.setService(rpcService);
    return export;
}