Class OnapMrFetchResponse
- java.lang.Object
-
- io.continual.onap.services.mrCommon.OnapMrResponse
-
- io.continual.onap.services.subscriber.OnapMrFetchResponse
-
public class OnapMrFetchResponse extends OnapMrResponse
-
-
Constructor Summary
Constructors Constructor Description OnapMrFetchResponse(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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringconsumeNext(long timeoutMs)Fetch the next message in this response.List<String>getMessages()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?OnapMrFetchResponsemarkEof()Mark the response stream as being at its endOnapMrFetchResponsepush(String msg)Push a message into this responseintreadyCount()Get the number of pending messages in the response.-
Methods inherited from class io.continual.onap.services.mrCommon.OnapMrResponse
getStatusCode, getStatusText, isSuccess
-
-
-
-
Constructor Detail
-
OnapMrFetchResponse
public OnapMrFetchResponse(int statusCode, String statusMsg)Construct this response with an empty set of messages and no EOF.- Parameters:
statusCode- the HTTP status codestatusMsg- the HTTP status text
-
-
Method Detail
-
push
public OnapMrFetchResponse push(String msg)
Push a message into this response- Parameters:
msg- a message from the service- Returns:
- this response
-
markEof
public OnapMrFetchResponse 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
public String consumeNext(long timeoutMs) throws InterruptedException
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 public List<String> 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
-
-