Looking for ttl setup on each message in spring cloud stream
i am able to set ttl on queue persistence message , using solace cloud broker GUI, but this settings is applied on each message with uniform value, is there any way keep this value in application.yaml or properties file and during message published time it will be applied for each messages.
In solace doc it's says you can pass ttl for each message at run time , but can't find an example with spring cloud stream or spring boot application.
Best Answer
-
Hi @manzarul,
You're correct that it can currently only be set on the header of each message. Unfortunately time to live isn't a setting exposed via JCSMPProperties that our Spring Boot apps can easily set. If you feel strongly that this should be allowed please feel free to open an enhancement via github requesting it
Note there is a whole list of properties that can be set under
solace.java.apiProperties
here.0
Answers
-
We can use like below fn :
-- application.yaml spring: cloud: function: definition: mySupplier stream: poller: fixed-delay: 5000 bindings: mySupplier-in-0: destination: test-q group: nonexclusive mySupplier-out-0: destination: test/topic/abc -- code @Bean Supplier<Message<String>> mySupplier(){ return () -> { return MessageBuilder.withPayload("Welcome to solace world!").setHeader("solace_timeToLive", 13000L).build(); }; }
0 -
Hi @manzarul,
You're correct that it can currently only be set on the header of each message. Unfortunately time to live isn't a setting exposed via JCSMPProperties that our Spring Boot apps can easily set. If you feel strongly that this should be allowed please feel free to open an enhancement via github requesting it
Note there is a whole list of properties that can be set under
solace.java.apiProperties
here.0