如何在同一交换机上将RabbitListener绑定到多个路由键

问题描述

如何在同一交换机上将Rabbit侦听器绑定到多个路由键?

这是我到目前为止所拥有的:

@RabbitListener(bindings = {
    @QueueBinding(value =
        @Queue(value = "foo"),exchange = @Exchange("ex1"),key="foo")
})
public void listen(String in) {
    // Do something
}

解决方法

9批注的 #define BATCHES 2 // add a batch dimension NNType weightH[BATCHES][HID][IN]; // weights layer hidden NNType biasesH[BATCHES][HID]; // biases layer hidden NNType weightO[BATCHES][OUT][HID]; // weights output NNType biasesO[BATCHES][OUT]; // biases output int i,j; NNType error[BATCHES] = {0}; // updated prototype to train multiple batches void TrainNet(NNType inp1,NNType inp2,NNType result,NNType *error,int batch); //init your stuff with random val as before for BATCHES dim init(); // train for (j=0;j<BATCHES;j++) { for (i=0;i<10000/BATCHES;i++) { TrainNet(0,&error[j],j); // input 0 0 result 0 TrainNet(0,1,j); // input 0 1 result 1 TrainNet(1,j); // input 1 0 result 1 TrainNet(1,j); // input 1 1 result 0 if (error[j]<0.0001) break; // exit the training with a low error } } 属性如下:

key

因此,您只需要列出这些路由键的列表即可:

@QueueBinding

或者您从这些JavaDoc中看到的模式。