java - Durable queues using Spring Rabbitmq Stomp -
i have following configurations spring , rabbitmq:
spring boot : 1.2.7
rabbitmq : 3.5.4
i using following spring beans 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 client connects end point, temporary queue gets created , response data streamed through queue. if clients disconnected, queue gets deleted , messages lost.
to prevent this, want create durable queues (as these queues have durable set false , auto-delete set true) if not, want have expiration set on these queues (e.g. 1 hour or something). rabbitmq documentation, seems can pass these values in headers, however, applicable versions 3.6.0 onwards, have 3.5.4, it's not option.
is there other way can configure this? (another approach add kind of listener connect request , configure queue parameters programmatically? not sure whether feasible don't know spring rabbitmq stomp plugin)
wondering if have tried declaring queue durable using rabbitmqadmin tool ?
rabbitmqadmin declare queue name=your-queue durable=true
admin tool can downloaded here https://www.rabbitmq.com/management-cli.html
Comments
Post a Comment