Package org.springframework.amqp.remoting.client

Examples of org.springframework.amqp.remoting.client.AmqpProxyFactoryBean


    serviceExporter.setAmqpTemplate(sentSavingTemplate);
    serviceExporter.setService(testService);
    serviceExporter.setServiceInterface(TestServiceInterface.class);

    // Set up the client
    AmqpProxyFactoryBean amqpProxyFactoryBean = new AmqpProxyFactoryBean();
    amqpProxyFactoryBean.setServiceInterface(TestServiceInterface.class);
    AmqpTemplate directForwardingTemplate = new AbstractAmqpTemplate() {
      @Override
      public Object convertSendAndReceive(Object payload) throws AmqpException {
        MessageConverter messageConverter = serviceExporter.getMessageConverter();

        Address replyTo = new Address("fakeExchangeName", "fakeRoutingKey");
        MessageProperties messageProperties = new MessageProperties();
        messageProperties.setReplyToAddress(replyTo);
        Message message = messageConverter.toMessage(payload, messageProperties);

        serviceExporter.onMessage(message);

        Message resultMessage = sentSavingTemplate.getLastMessage();
        return messageConverter.fromMessage(resultMessage);
      }
    };
    amqpProxyFactoryBean.setAmqpTemplate(directForwardingTemplate);
    amqpProxyFactoryBean.afterPropertiesSet();
    Object rawProxy = amqpProxyFactoryBean.getObject();
    riggedProxy = (TestServiceInterface) rawProxy;
  }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.remoting.client.AmqpProxyFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.