Try PubSub+

Spring Cloud Stream msgTtl on producer/supplier binding

Mike13Mike13 Member Posts: 21

Hi there
I tried this:

spring.cloud.stream.bindings.bookSupplierV1-out-0.destination=v1/bookJson
spring.cloud.stream.bindings.bookSupplierV1-out-0.binder=solace1

This works.
But when I do this in addition:

spring.cloud.stream.solace.bindings.bookSupplierV1-out-0.producer.msgTtl=23000

no message is sent to the destination.

The value in the SolaceProducerProperties is set to: 23000
This is also set:
xmlMessage.setTimeToLive(producerProperties.getMsgTtl());

public XMLMessage map(Message<?> message, SolaceProducerProperties producerProperties) {
XMLMessage xmlMessage = map(message);
xmlMessage.setDMQEligible(producerProperties.isMsgInternalDmqEligible());
if (producerProperties.getMsgTtl() != null) {
xmlMessage.setTimeToLive(producerProperties.getMsgTtl());
}
return xmlMessage;
}

Is this a bug or am I missing something?

Comments

  • marcmarc Member, Administrator, Moderator, Employee Posts: 230 admin

    Hi @Mike13 ,
    Weird, it's working for me. Are you getting any sort of errors on app startup? I'm trying to think of a reason it wouldn't actually send the message. This what I did just to try it out in a simple app:

    Version info from pom

        <properties>
            <java.version>11</java.version>
            <solace-spring-cloud.version>1.1.1</solace-spring-cloud.version>
            <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
        </properties>
    
    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    
        @Bean
        public Supplier<String> supplier(){
            return () -> {
                System.out.println("Sending Hello World");
                return "Hello World";
            };
        }
    
    spring:
      cloud:
        function:
          definition: supplier
        stream:
          bindings:
            supplier-out-0:
              destination: output/test
          solace: 
            bindings:
              supplier-out-0:
                producer:
                  msgTtl: 23000
    

    And then listening with sdkperf I can see the messages with the TTL set:

  • Mike13Mike13 Member Posts: 21

    Hi @marc
    I have not seen any error message.
    It seems like it works with one binder (Solace), but with two binders (Solace and Kafka), like we have in our test project, it doesn't work. I need to take a closer look at this...

  • marcmarc Member, Administrator, Moderator, Employee Posts: 230 admin
    edited December 2020

    Hey @Mike13, that's intriguing. Let me know what you find! I didn't have much time to look into it but I did quickly try using two solace binders in the same app and it continued working. Weird that for some reason using the Solace and Kafka binders together would act differently.

    As a heads up I'm going out on vacation for the holidays so if I don't get back to you in a timely manner that's why :)

Sign In or Register to comment.