В настоящее время у меня есть два сервиса:
- ServiceA, являющийся производителем, со следующими свойствами:
Код: Выделить всё
spring:
cloud:
stream:
default-binder: rabbit
bindings:
new-price-out:
destination: new-price
content-type: application/json
rabbit:
binder:
host: localhost
port: 5672
username: guest
password: guest
Код: Выделить всё
@Component
public class RabbitMqAdapter implements MessageQueuePort {
private final StreamBridge streamBridge;
private final String CREATE_PRICE_BINDING = "new-price-out";
public RabbitMqAdapter(StreamBridge streamBridge){
this.streamBridge = streamBridge;
}
@Override
public void sendPriceCreationMessage(QuickPriceAnalysisRequest request) {
streamBridge.send(CREATE_PRICE_BINDING, request);
}
}
Код: Выделить всё
spring:
cloud:
stream:
default-binder: rabbit
bindings:
new-price-in:
destination: new-price # Same exchange name as the producer
content-type: application/json
group: price-consumers
rabbit:
bindings:
consumer:
declareExchange: false
binder:
host: localhost
port: 5672
username: guest
password: guest
Код: Выделить всё
@Component
@RequiredArgsConstructor
public class RabbitInAdapter implements PriceCreationEventPort{
private final NewPriceUseCase newPriceUseCase;
@Bean
@Override
public Consumer newPrice() {
return message -> {
CreatePriceCommand payload = message.getPayload();
};
}
}
Проблема в том, что у меня все еще есть две отдельные биржи, которые мне нужно связать вручную. Так как обмен "новая цена" не имеет привязок.
обмен новых цен
newPrice-in-0
работает ручная настройка
Можете ли вы подсказать, как это исправить?
Подробнее здесь: https://stackoverflow.com/questions/793 ... -exchanges
Мобильная версия