Source:
<code>protected ImmutableList<PubsubMessage> sendBatch(final List<PubsubMessage> batch) throws InterruptedException { final int batchSize = batch.size(); final List<ApiFuture<String>> sendResults = batch.stream() .map(publisher::publish) .collect(Collectors.toCollection(() -> new ArrayList<>(batchSize))); final ImmutableList.Builder<PubsubMessage> remaining = ImmutableList.builder(); for (int i = 0; i < batchSize; ++i) { final ApiFuture<String> pendingResult = sendResults.get(i); try { final String messageId = pendingResult.get(); if (logger.isDebugEnabled()) { final PubsubMessage message = batch.get(i); logger.debug("Finished sending event (partyId={}, eventId={}) to Pub/Sub: messageId = {}", <START> message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID), <END> message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID), messageId); } } catch (final ExecutionException e) { final PubsubMessage message = batch.get(i); final Throwable cause = e.getCause(); if (cause instanceof ApiException) { final ApiException apiException = (ApiException) cause; if (apiException.isRetryable()) { logger.debug("Transient error sending event (partyId={}, eventId={}) to Pub/Sub; retrying.", message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID), message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID), cause); remaining.add(message); } else { logger.warn("Permanent error sending event (partyId={}, eventId={}) to Pub/Sub; abandoning.", message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID), message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID), cause); } } else { logger.error("Unknown error sending event (partyId={}, eventId={}) to Pub/Sub; abandoning.", message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID), message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID), cause); } } } return remaining.build(); }</code><technical_language>debug logging change applicationflow. getAttributesOrThrow would. getAttributesOrDefault is I</technical_language>

Target:
protected ImmutableList<PubsubMessage> sendBatch(final List<PubsubMessage> batch) throws InterruptedException { final int batchSize = batch.size(); final List<ApiFuture<String>> sendResults = batch.stream() .map(publisher::publish) .collect(Collectors.toCollection(() -> new ArrayList<>(batchSize))); final ImmutableList.Builder<PubsubMessage> remaining = ImmutableList.builder(); for (int i = 0; i < batchSize; ++i) { final ApiFuture<String> pendingResult = sendResults.get(i); try { final String messageId = pendingResult.get(); if (logger.isDebugEnabled()) { final PubsubMessage message = batch.get(i); logger.debug("Finished sending event (partyId={}, eventId={}) to Pub/Sub: messageId = {}", message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID, "N/A"), message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID, "N/A"), messageId); } } catch (final ExecutionException e) { final PubsubMessage message = batch.get(i); final Throwable cause = e.getCause(); if (cause instanceof ApiException) { final ApiException apiException = (ApiException) cause; if (apiException.isRetryable()) { logger.debug("Transient error sending event (partyId={}, eventId={}) to Pub/Sub; retrying.", message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID, "N/A"), message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID, "N/A"), cause); remaining.add(message); } else { logger.warn("Permanent error sending event (partyId={}, eventId={}) to Pub/Sub; abandoning.", message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID, "N/A"), message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID, "N/A"), cause); } } else { logger.error("Unknown error sending event (partyId={}, eventId={}) to Pub/Sub; abandoning.", message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID, "N/A"), message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID, "N/A"), cause); } } } return remaining.build(); }