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

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

Introduction

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

Prototype

public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory) 

Source Link

Document

Set the QueueConnectionFactory to use for obtaining JMS QueueConnections.

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 . ja v  a  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 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  ww .ja  va 2s  .c  om
 *
 * @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;
}