C
- The type of the service's configuration.public interface StreamClient<C extends StreamClientConfiguration>
An implementation has to be thread-safe.
Its constructor may throw InitializationException
.
Modifier and Type | Method and Description |
---|---|
C |
getConfiguration() |
StreamResponseMessage |
sendRequest(StreamRequestMessage message)
Sends the given request via TCP (HTTP) and returns the response.
|
void |
stop()
Stops the service, closes any connection pools etc.
|
StreamResponseMessage sendRequest(StreamRequestMessage message) throws InterruptedException
This method must implement expiration of timed out requests using the
StreamClientConfiguration
settings. When a request expires, a
null
response will be returned.
This method will always try to complete execution without throwing an exception. It will
return null
if an error occurs, and optionally log any exception messages.
The rules for logging are:
FINE
.INFO
level.WARNING
level
This method is required to add a Host
HTTP header to the
outgoing HTTP request, even if the given
StreamRequestMessage
does not contain such a header.
This method will add the User-Agent
HTTP header to the outgoing HTTP request if
the given message did not already contain such a header. You can set this default value in your
StreamClientConfiguration
.
message
- The message to send.null
if no response has been received or an error occurred.InterruptedException
- if you interrupt the calling thread.void stop()
C getConfiguration()
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.