Class RealTimeRatingProposalUpdate
java.lang.Object
energy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
energy.trolie.client.request.ratingproposals.RealTimeRatingProposalUpdate
- All Implemented Interfaces:
StreamingUpdate<RealTimeRatingProposalStatus>
,AutoCloseable
public class RealTimeRatingProposalUpdate
extends energy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
Streaming update for real-time rating proposals. Users stream out proposals by invoking methods in the following sequence:
begin(ProposalHeader)
with a completely populated header.rating(RealTimeRating)
for rating value set.complete()
to synchronously finish the request.
-
Field Summary
Fields inherited from class energy.trolie.client.impl.request.AbstractStreamingUpdate
objectMapper
-
Constructor Summary
ConstructorsConstructorDescriptionRealTimeRatingProposalUpdate
(org.apache.hc.client5.http.classic.HttpClient httpClient, TrolieHost host, org.apache.hc.client5.http.config.RequestConfig requestConfig, int bufferSize, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Map<String, String> httpHeader) Constructs new update. -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin
(ProposalHeader header) Begin the stream, sending a populated headervoid
close()
Clean up the stream and terminate the request thread if it is still runningcomplete()
Finalize the request.protected org.apache.hc.core5.http.ContentType
protected String
getPath()
protected org.apache.hc.client5.http.classic.methods.HttpUriRequestBase
protected Function<org.apache.hc.core5.http.HttpEntity,
RealTimeRatingProposalStatus> void
rating
(RealTimeRating rating) Send a rating value set for a given resource.Methods inherited from class energy.trolie.client.impl.request.AbstractStreamingUpdate
checkCanWrite, completeRequest, createRequestOutputStream, getFullPath, handleWriteError
-
Constructor Details
-
RealTimeRatingProposalUpdate
public RealTimeRatingProposalUpdate(org.apache.hc.client5.http.classic.HttpClient httpClient, TrolieHost host, org.apache.hc.client5.http.config.RequestConfig requestConfig, int bufferSize, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Map<String, String> httpHeader) Constructs new update. Should generally not be called by application code- Parameters:
httpClient
- clienthost
- hostrequestConfig
- client request configbufferSize
- internal buffer sizeobjectMapper
- Jackson object mapperhttpHeader
- mapped header list
-
-
Method Details
-
getRequest
protected org.apache.hc.client5.http.classic.methods.HttpUriRequestBase getRequest()- Specified by:
getRequest
in classenergy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
- Returns:
- Apache HTTP client request associated with this request.
-
getContentType
protected org.apache.hc.core5.http.ContentType getContentType()- Specified by:
getContentType
in classenergy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
- Returns:
- content type associated with this update
-
getPath
- Specified by:
getPath
in classenergy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
- Returns:
- HTTP path associated with this update
-
getResponseHandler
protected Function<org.apache.hc.core5.http.HttpEntity,RealTimeRatingProposalStatus> getResponseHandler()- Specified by:
getResponseHandler
in classenergy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
- Returns:
- handler associated with this update.
-
begin
Begin the stream, sending a populated header- Parameters:
header
- populated header. Must include at least emergency rating durations and power system resources
-
rating
Send a rating value set for a given resource.- Parameters:
rating
- value set
-
complete
Finalize the request.- Returns:
- status of the proposal retrieved from the TROLIE server. NOTE: TROLIE allows for partial proposal updates. Be sure to check and appropriately log any validation errors returned with this status, as they will indicate that ratings were not sent successfully for those resources.
-
close
public void close()Description copied from class:energy.trolie.client.impl.request.AbstractStreamingUpdate
Clean up the stream and terminate the request thread if it is still running- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classenergy.trolie.client.impl.request.AbstractStreamingUpdate<RealTimeRatingProposalStatus>
-