I wrote simple sample to read text from console and send it to the rabbitMq server:
@Configuration
@EnableIntegration
@IntegrationComponentScan
public class Config {
@Autowired
private AmqpTemplate amqpTemplate;
@Bean
public IntegrationFlow fromConsoleToRabbitFlow() {
return IntegrationFlows.from(consoleSource(), c -> c.id("consoleInput")
.poller(Pollers.fixedRate(1000))
.autoStartup(true)
).channel("consoleOutputChannel")
.handle(Amqp.outboundAdapter(amqpTemplate).routingKey("my_spring_integration_queue"))
.get();
}
public MessageSource<String> consoleSource() {
return CharacterStreamReadingMessageSource.stdin();
}
}
It looks like almost working solution but I can't find my_spring_integration_queue
in rabbitmq admin console:
But I can't find anything related to 'my_spring_integration_queue' on other tab. Where can I find it ?
I expect that application will create queue if it doesn't exist. I was not able to find a method for send into the queur so I used .routingKey
method. I also tried .exchangeName
method but it lead to the:
32019-08-27 13:26:15.972 ERROR 16372 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'my_spring_integration_queue' in vhost '/', class-id=60, method-id=40)
P.S.
the Queue tab looks like this: