Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Spring集成中向exchange动态添加队列_Java_Spring_Spring Boot_Spring Integration_Spring Integration Amqp - Fatal编程技术网

Java 如何在Spring集成中向exchange动态添加队列

Java 如何在Spring集成中向exchange动态添加队列,java,spring,spring-boot,spring-integration,spring-integration-amqp,Java,Spring,Spring Boot,Spring Integration,Spring Integration Amqp,我在integrationcontext.xml中进行了以下交换 <!-- rabbit exchanges, queues, and bindings used by this app --> <rabbit:topic-exchange name="newPaymentEventsExchange" auto-delete="false" durable="true"> <rabbit:bindings> </rabbit:bind

我在integrationcontext.xml中进行了以下交换

<!-- rabbit exchanges, queues, and bindings used by this app -->
<rabbit:topic-exchange name="newPaymentEventsExchange" auto-delete="false" durable="true">
    <rabbit:bindings>

    </rabbit:bindings>
</rabbit:topic-exchange>

使用
AmqpAdmin
执行此类操作:

/**
 * Declare the given queue.
 * @param queue the queue to declare.
 * @return the name of the queue.
 */
String declareQueue(Queue queue);

/**
 * Declare a binding of a queue to an exchange.
 * @param binding a description of the binding to declare.
 */
void declareBinding(Binding binding);

您可以考虑使用<代码> QueueBuilder < /C>和<代码> BindingBuilder < /> >以方便:

QueueBuilder.nonDurable("foo")
    .autoDelete()
    .exclusive()
    .withArgument("foo", "bar")
    .build()
...
BindingBuilder.bind(
            marketDataQueue()).to(marketDataExchange()).with(marketDataRoutingKey)

QueueBuilder.nonDurable("foo")
    .autoDelete()
    .exclusive()
    .withArgument("foo", "bar")
    .build()
...
BindingBuilder.bind(
            marketDataQueue()).to(marketDataExchange()).with(marketDataRoutingKey)