@Override
protected String run() {
try {
// The named client param must match the prefix for the ribbon
// configuration specified in the edge.properties file
RestClient client = (RestClient) ClientFactory
.getNamedClient("middletier-client");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.putSingle("log", URLEncoder.encode(log, Charsets.UTF_8.name()));
// Note: If running locally on MacOS, you'll need to make sure your
// /etc/hosts file contains the following entry:
// 127.0.0.1 <hostname>.local
// or else this will likely fail.
HttpClientRequest request = HttpClientRequest
.newBuilder()
.setVerb(Verb.POST)
.setUri(new URI("/service/"
+ FluxConstants.MIDDLETIER_WEB_RESOURCE_ROOT_PATH
+ "/"
+ FluxConstants.MIDDLETIER_WEB_RESOURCE_VERSION
+ "/"
+ FluxConstants.MIDDLETIER_WEB_RESOURCE_ADD_PATH
+ "/"
+ key)
)
.setQueryParams(queryParams)
.build();
HttpClientResponse response = client
.executeWithLoadBalancer(request);
if (response.getStatus() != 200) {
logger.error("error status: {}", response.getStatus());
throw new Exception("error status: " + response.getStatus());