forked from mtusi2026/mtusi2026lab5
ЛР5: реализована асинхронная обработка изображений (оценка 3)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class RabbitConfig {
|
||||
|
||||
public static final String QUEUE_NAME = "image-processing-queue";
|
||||
public static final String EXCHANGE_NAME = "image-exchange";
|
||||
public static final String ROUTING_KEY = "image.process";
|
||||
|
||||
@Bean
|
||||
public Queue imageQueue() {
|
||||
// durable = true (сохраняется при перезапуске RabbitMQ)
|
||||
return new Queue(QUEUE_NAME, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DirectExchange exchange() {
|
||||
return new DirectExchange(EXCHANGE_NAME);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding binding(Queue imageQueue, DirectExchange exchange) {
|
||||
return BindingBuilder.bind(imageQueue).to(exchange).with(ROUTING_KEY);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user