Class OnapMrFetchResponse
java.lang.Object
io.continual.onap.services.mrCommon.OnapMrResponse
io.continual.onap.services.subscriber.OnapMrFetchResponse
-
Constructor Summary
ConstructorsConstructorDescriptionOnapMrFetchResponse(int statusCode, String statusMsg) Construct this response with an empty set of messages and no EOF.OnapMrFetchResponse(int statusCode, String statusMsg, List<String> msgs) Construct this response with a finished set of messages. -
Method Summary
Modifier and TypeMethodDescriptionconsumeNext(long timeoutMs) Fetch the next message in this response.Deprecated.Client code should call consumeNext() with a timeout value setbooleanisEof()Is this response at the end of its stream, with all pending messages consumed?markEof()Mark the response stream as being at its endPush a message into this responseintGet the number of pending messages in the response.Methods inherited from class io.continual.onap.services.mrCommon.OnapMrResponse
getStatusCode, getStatusText, isSuccess
-
Constructor Details
-
OnapMrFetchResponse
Construct this response with an empty set of messages and no EOF.- Parameters:
statusCode- the HTTP status codestatusMsg- the HTTP status text
-
OnapMrFetchResponse
Construct this response with a finished set of messages.- Parameters:
statusCode- the HTTP status codestatusMsg- the HTTP status textmsgs- the set of messages in the response
-
-
Method Details
-
push
Push a message into this response- Parameters:
msg- a message from the service- Returns:
- this response
-
markEof
Mark the response stream as being at its end- Returns:
- this response
-
isEof
public boolean isEof()Is this response at the end of its stream, with all pending messages consumed?- Returns:
- true if there are no more messages
-
readyCount
public int readyCount()Get the number of pending messages in the response. This count does not include messages that have not yet been delivered via the response stream.- Returns:
- the count of pending messages
-
consumeNext
Fetch the next message in this response.- Parameters:
timeoutMs- the length of time to wait for the next message (which could potentially be in-flight)- Returns:
- a message, or null if all of the response has been consumed
- Throws:
InterruptedException- if the wait is interrupted
-
getMessages
Deprecated.Client code should call consumeNext() with a timeout value setConsume all messages in the response, blocking until the end of the stream.- Returns:
- a list of messages
-