2

I'm creating a web service that is a gateway to another web service. I'm using the Spring Integration framework, specifically an Http Inbound Gateway to accept incoming requests. When the reply-timeout is triggered, a 200 status code is returned. Ideally I'd like to return a 504 since my web service has not received a timely reply from the other web service I'm communicating with.

 <int-http:inbound-gateway request-channel="authorizationRequestsChannel"
                      reply-channel="myReplyChannel"
                      path="/endpoint"
                      reply-timeout="30000"
                      supported-methods="POST" />

tl;dr

When the reply channel times-out, the inbound-gateway returns a 200 status code. Is it possible to set the status code to another value?

Justin Garrick
  • 14,767
  • 7
  • 41
  • 66
MDrabic
  • 917
  • 8
  • 15

1 Answers1

1

Not directly.

However, you can add an error channel; and set a timeout on your downstream component. The error flow will be invoked when the flow throws an exception and the error flow can return a message with a status code header.

We'll take a look at adding a mechanism to customize the status code for a timeout.

I opened a JIRA Issue.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179