I have the following configurations for Spring and RabbitMQ:
Spring Boot : 1.2.7
RabbitMQ : 3.5.4
I am using the following Spring beans to create Stomp endpoint (My config class extends AbstractWebSocketMessageBrokerConfigurer
):
@Bean
public TopicExchange streamingExchange(@Qualifier("admin") final RabbitAdmin rabbitAdmin) {
TopicExchange topicExchange = new TopicExchange(exchangeName, true, false);
topicExchange.setAdminsThatShouldDeclare(rabbitAdmin);
return topicExchange;
}
@Override
public void configureMessageBroker(final MessageBrokerRegistry config) {
config.enableStompBrokerRelay("/my_stream", "/test").setRelayHost(host)
.setSystemLogin(username).setSystemPasscode(password).setClientLogin(username)
.setClientPasscode(password);
}
@Override
public void registerStompEndpoints(final StompEndpointRegistry registry) {
registry.addEndpoint("/test").setAllowedOrigins("*").withSockJS();
}
Now, when a client connects to this end point, a temporary queue gets created and response data is streamed through the queue. If clients get disconnected, queue gets deleted and messages are lost.
To prevent this, I want to create durable queues (as these queues are have durable set to false and auto-delete set to true) if not, I want to have some expiration set on these queues (e.g. 1 hour or something). From RabbitMQ documentation, it seems we can pass these values in headers, however, that is only applicable for versions 3.6.0 onwards, as we have 3.5.4, it's not an option.
Is there any other way by which we can configure this? (Another approach would be to add some kind of Listener for connect request and configure queue parameters programmatically? I am not sure whether this is feasible as I don't know much about spring rabbitmq stomp plugin)