try {
final List<message> remains = close(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
if (remains.isEmpty()) {
- getLog().warn("Closing publisher with " + remains.size() + " messages unsent. "
- + "Consider using MRBatchingPublisher.close( long timeout, TimeUnit timeoutUnits ) to recapture unsent messages on close.");
+ getLog().warn("Closing publisher with {} messages unsent. Consider using MRBatchingPublisher.close( long timeout, TimeUnit timeoutUnits ) to recapture unsent messages on close.",
+ remains.size());
}
} catch (InterruptedException e) {
getLog().warn("Possible message loss. " + e.getMessage(), e);
DME2Configue();
Thread.sleep(5);
- getLog().info("sending " + fPending.size() + " msgs to " + url + subContextPath + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info(String
+ .format("sending %d msgs to %s%s. Oldest: %d ms", fPending.size(), url, subContextPath,
+ nowMs - fPending.peek().timestamp));
sender.setPayload(os.toString());
String dmeResponse = sender.sendAndWait(5000L);
}
if (ProtocolTypeConstants.AUTH_KEY.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final JSONObject result =
postAuth(new PostAuthDataObject().setPath(httpurl).setData(baseStream.toByteArray())
.setContentType(contentType).setAuthKey(authKey).setAuthDate(authDate)
}
if (ProtocolTypeConstants.AAF_AUTH.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final JSONObject result = post(httpurl, baseStream.toByteArray(), contentType, username, password,
protocolFlag);
}
if (ProtocolTypeConstants.HTTPNOAUTH.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final JSONObject result = postNoAuth(httpurl, baseStream.toByteArray(), contentType);
// Here we are checking for error response. If HTTP status
DME2Configue();
Thread.sleep(5);
- getLog().info("sending " + fPending.size() + " msgs to " + url + subContextPath + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}{}. Oldest: {} ms", fPending.size(), url, subContextPath,
+ nowMs - fPending.peek().timestamp);
sender.setPayload(os.toString());
String dmeResponse = sender.sendAndWait(5000L);
}
if (ProtocolTypeConstants.AUTH_KEY.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final String result = postAuthwithResponse(httpurl, baseStream.toByteArray(), contentType, authKey,
authDate, username, password, protocolFlag);
// Here we are checking for error response. If HTTP status
}
if (ProtocolTypeConstants.AAF_AUTH.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final String result = postWithResponse(httpurl, baseStream.toByteArray(), contentType, username,
password, protocolFlag);
}
if (ProtocolTypeConstants.HTTPNOAUTH.getValue().equalsIgnoreCase(protocolFlag)) {
- getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
- + (nowMs - fPending.peek().timestamp) + " ms");
+ getLog().info("sending {} msgs to {}. Oldest: {} ms", fPending.size(), httpurl,
+ nowMs - fPending.peek().timestamp);
final String result = postNoAuthWithResponse(httpurl, baseStream.toByteArray(), contentType);
// Here we are checking for error response. If HTTP status
fPending.clear();
return pubResponse;
}
- } catch (IllegalArgumentException x) {
+ } catch (IllegalArgumentException | HttpException x) {
getLog().warn(x.getMessage(), x);
pubResponse.setResponseCode(String.valueOf(HttpStatus.SC_BAD_REQUEST));
pubResponse.setResponseMessage(x.getMessage());
getLog().warn(x.getMessage(), x);
pubResponse.setResponseCode(String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR));
pubResponse.setResponseMessage(x.getMessage());
-
- } catch (HttpException x) {
- getLog().warn(x.getMessage(), x);
- pubResponse.setResponseCode(String.valueOf(HttpStatus.SC_BAD_REQUEST));
- pubResponse.setResponseMessage(x.getMessage());
-
} catch (Exception x) {
getLog().warn(x.getMessage(), x);