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

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

Introduction

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

Prototype

@Override
    public void afterPropertiesSet() 

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  ww. j  a va  2  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;
}