0

Is there a way I can wrap a http:outbound gateway REST API call with Hystrix Command. I saw some reference to using a custom request handler advice, not sure how I would go about doing it.

Murali J
  • 1
  • 1
  • Please, explain why do you need Hystrix there and why do you think that there is something like `fallback method` somewhere around that http:Outbound, so you can apply Hystrix? – Artem Bilan May 02 '18 at 02:39

1 Answers1

0

See here: Wrap spring integration outbound gateway calls with hystrix command. I can't close your question as duplicate because nobody voted for my answer. But still: the same solution must be applied for your use-case:

@ServiceActivator(inputChannel = "serviceChannel")
@HystrixCommand(fallbackMethod = "serviceFallback")
public String myService(String payload) {
    // Some external service call
}

public String serviceFallback(String payload) {
    // some fallback logic
}

See also sample in my sendbox: https://github.com/artembilan/sendbox/tree/master/spring-integration-with-hystrix

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118