2

My Gateway looks like this ...

@MessagingGateway
public interface MyGateway {
    @Gateway(requestChannel = "startChannel", replyTimeout = 1000L)
    ListenableFuture<Boolean> myFlow();
}

I use an application.yml file to define some properties which I use throughout my application. One of those is a timeout value.

I would like to make MyGateway's replyTimeout parameter configurable.

Could someone suggest how I can do that?

Note that MyGateway is an Interface so I cannot use @PostConstruct or @Autowired (as I understand it).

Thanks in advance!

Rob O'Doherty
  • 549
  • 3
  • 14

1 Answers1

1

We have an open JIRA on the matter: https://jira.spring.io/browse/INT-3615.

But I have an workaround for you:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@MessagingGateway
public @interface MyMessagingGateway {

    String defaultReplyTimeout() default "" + Long.MIN_VALUE;

}

And use this annotation like:

@MyMessagingGateway(defaultReplyTimeout = "${reply.timeout}")
public interface MyGateway {
    @Gateway(requestChannel = "startChannel")
    ListenableFuture<Boolean> myFlow();
}
Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thank you, Artem! That appears to have had the effect that I was looking for. Now I just need to learn how to tell Spring Integration to interrupt the threads that I now consider to have timed out. – Rob O'Doherty May 21 '15 at 13:13