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

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

Introduction

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

Prototype

public void setServiceInterface(Class<?> serviceInterface) 

Source Link

Document

Set the interface that the proxy must implement.

Usage

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

/**
 * Creates and returns a proxy object which can be
 * used to consume a remote service./* w  w w  .j  a va 2s . c o  m*/
 * 
 * @param <T> Type of Service Interface
 * @param cf JMS Connection Factory
 * @param queueName Name of JMS Queue used for communication
 * @param serviceClass Service Interface Class
 * @return Proxy for the remote service
 */
@SuppressWarnings("unchecked")
/* Ignore Unchecked Cast */
public static <T> T createProxy(ConnectionFactory cf, String queueName, Class<T> serviceClass) {

    // Create Proxy Factory Instance
    JmsInvokerProxyFactoryBean proxyFactory = new JmsInvokerProxyFactoryBean();
    proxyFactory.setConnectionFactory(cf);
    proxyFactory.setQueueName(queueName);
    proxyFactory.setServiceInterface(serviceClass);
    proxyFactory.afterPropertiesSet();

    // Return Proxy
    return (T) proxyFactory.getObject();
}

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

/**
 * RPC??/*from w  w  w .  ja  v a 2s .co  m*/
 *
 * @param queueName ??
 * @param serviceInterfaceClazz ???
 * @return
 */
protected JmsInvokerProxyFactoryBean buildRpcServiceProxyFactoryBean(String queueName,
        Class<?> serviceInterfaceClazz) {
    JmsInvokerProxyFactoryBean proxy = new JmsInvokerProxyFactoryBean();
    proxy.setConnectionFactory(jmsConnectionFactory());
    proxy.setMessageConverter(messageConverter());
    proxy.setQueueName(queueName);
    proxy.setServiceInterface(serviceInterfaceClazz);
    return proxy;
}