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

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

Introduction

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

Prototype

JmsInvokerServiceExporter

Source Link

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./*from   w  w w. j  a va2 s  .  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??/*  w w  w  .  ja  v  a  2s  .c  om*/
 * 
 * @param rpcService ?
 * @param rpcServiceInterfaceClazz
 * @return
 */
protected JmsInvokerServiceExporter buildRpcServiceExport(Object rpcService,
        Class<?> rpcServiceInterfaceClazz) {
    JmsInvokerServiceExporter export = new JmsInvokerServiceExporter();
    export.setServiceInterface(rpcServiceInterfaceClazz);
    export.setService(rpcService);
    return export;
}