Commit f1d8fa8a authored by yanzg's avatar yanzg

接口文档的支持

parent 85a5cbc8
......@@ -26,15 +26,24 @@ public class MqConsumeDynamic {
@Resource
private RabbitAdmin rabbitAdmin;
@Value("${yzg.onOfConsumer:10}")
private int onOfConsumer;
@Value("${spring.rabbitmq.listener.concurrency:1}")
private int concurrency;
@Value("${spring.rabbitmq.listener.max-concurrency:10}")
private int maxConcurrency;
@Value("${spring.rabbitmq.listener.prefetch:100}")
private int prefetch;
@Value("${spring.rabbitmq.listener.transaction-size:100}")
private int txSize;
public SimpleMessageListenerContainer init(String queueName, ChannelAwareMessageListener messageListener) {
ConsumerSimpleMessageListenerContainer container = new ConsumerSimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setAcknowledgeMode(AcknowledgeMode.MANUAL);
container.setQueueNames(queueName);
container.setConcurrentConsumers(onOfConsumer);
container.setConcurrentConsumers(concurrency);
container.setMaxConcurrentConsumers(maxConcurrency);
container.setPrefetchCount(prefetch);
container.setTxSize(txSize);
container.setMessageListener(new MessageListenerAdapter(messageListener));
container.start();
return container;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment