armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Add StreamMessage.timeout()

Open sjy982 opened this issue 1 year ago โ€ข 6 comments

Motivation: Currently, the aggregate() and subscribe() methods of StreamMessage do not have the ability to set a timeout. This provides the ability to detect when a client or server has not responded for a period of time and handle it appropriately. Additionally, the timeout API can be used to detect idle streams by setting a timeout until the next message.

Modifications:

  1. Added the TimeoutStreamMessage class
  • Wrap a StreamMessage to provide timeout functionality
  • You can set a timeout feature by adding the timeout() method to the StreamMessage interface.
  1. Added the TimeoutSubscriber class
  • Schedule a timeout for each message.
  • StreamTimeoutMode allows you to set different timeout modes.
  1. Added StreamTimeoutMode enumeration
  • Defines the UNTIL_FIRST, UNTIL_NEXT, and UNTIL_EOS modes.
  1. Added a timeout method
  • Added the timeout method to the StreamMessage, HttpResponse, and HttpRequest interfaces to provide the ability to set a timeout.

Result:

  • Closes #5744
  • This change adds timeout functionality to the aggregate() and subscribe() methods of StreamMessage and HTTP requests/responses.
  • This allows idle streams to be detected and handled appropriately.
  • You can use StreamTimeoutMode to set the timeout between the arrival of the first message, the arrival of the next message, or the end of the stream.

sjy982 avatar Jun 13 '24 10:06 sjy982

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 13 '24 10:06 CLAassistant

๐Ÿ” Build Scanยฎ (commit: 24245a4d7ec6f865e902d498fa2a816a27c53c96)

Job name Status Build Scanยฎ
build-ubicloud-standard-8-jdk-8 โœ… https://ge.armeria.dev/s/onrrsbmyxwv7s
build-ubicloud-standard-8-jdk-21-snapshot-blockhound โœ… https://ge.armeria.dev/s/lo4aanlxcb2co
build-ubicloud-standard-8-jdk-17-min-java-17-coverage โŒ (failure) https://ge.armeria.dev/s/us7irp3ponwji
build-ubicloud-standard-8-jdk-17-min-java-11 โœ… https://ge.armeria.dev/s/woix3jlaukvdy
build-ubicloud-standard-8-jdk-17-leak โœ… https://ge.armeria.dev/s/4iy736pszda4g
build-ubicloud-standard-8-jdk-11 โœ… https://ge.armeria.dev/s/uddd2o3sck4ns
build-macos-12-jdk-21 โœ… https://ge.armeria.dev/s/vyf5i26tmjg4o

github-actions[bot] avatar Jun 13 '24 11:06 github-actions[bot]

Some of the descriptions in the Modifications field contain Korean.

Added StreamTimeoutMode enumeration UNTIL_FIRST, UNTIL_NEXT, UNTIL_EOS ๋ชจ๋“œ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

p.s. It's an interesting feature, so I'm watching with interest

Bue-von-hon avatar Jun 24 '24 01:06 Bue-von-hon

Some of the descriptions in the Modifications field contain Korean.

Added StreamTimeoutMode enumeration UNTIL_FIRST, UNTIL_NEXT, UNTIL_EOS ๋ชจ๋“œ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

p.s. It's an interesting feature, so I'm watching with interest

Thank you for your interest.

sjy982 avatar Jun 24 '24 13:06 sjy982

Last but not least, please sign the ICLA.

trustin avatar Jun 25 '24 03:06 trustin

Last but not least, please sign the ICLA.

I checked, thank you for your review.

sjy982 avatar Jun 25 '24 13:06 sjy982