salim
salim

Reputation: 39

amqp:outbound-gateway throwing ReplyRequiredException

Code:

<rabbit:template id="amqpTemplateCore"  connection-factory="connectionFactoryCore"  />
<bean id="connectionFactoryCore" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject"><ref bean="rabbitConfiguration" /></property>
        <property name="targetMethod"><value>connectionFactory</value></property>
    </bean>

<int-amqp:outbound-gateway
        request-channel="requestIn"
        reply-channel="requestOut"
        amqp-template="amqpTemplateCore" 
        exchange-name="CDS"
        routing-key="keyA">
</int-amqp:outbound-gateway>

bean:
public ConnectionFactory connectionFactory() {
        CachingConnectionFactory connectionFactory =
            new CachingConnectionFactory(host);
        connectionFactory.setVirtualHost(virtualhost);
        connectionFactory.setPort(port);
        connectionFactory.setUsername(username);
        connectionFactory.setPassword(password);
        connectionFactory.setPublisherReturns(true);
        connectionFactory.setPublisherConfirms(true);
        return (ConnectionFactory)connectionFactory;
    }

Upvotes: 1

Views: 80

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

An outbound-gateway is for request/reply scenario. When you send something to an external system and wait for reply from there.

If your logic is one-way, just to send and forget, consider to use <int-amqp:outbound-channel-adapter>.

Upvotes: 1

Related Questions