Delivery report callback called (from flush()) on successful or failed delivery of the message.
193059
def acked(err, msg):
    """"""
    if err is not None:
        print("failed to deliver message: {}".format(err.str()))
    else:
        print("produced to: {} [{}] @ {}".format(msg.topic(), msg.partition(), msg.offset()))
1332822
async def flush(self, request: BernardRequest):
        

        if self._acq and 'callback_query' in self._update:
            try:
                cbq_id = self._update['callback_query']['id']
            except KeyError:
                pass
            else:
                await self.platform.call(
                    'answerCallbackQuery',
                    **(await self._acq.serialize(cbq_id))
                )

        return await super(TelegramResponder, self).flush(request)
108495
def done(self, on_success=None, on_failure=None):
        """"""
        if on_success is not None:
            if self._state == 'pending':
                self._callbacks.append(on_success)
            elif self._state == 'resolved':
                on_success(self.value)
        if on_failure is not None:
            if self._state == 'pending':
                self._errbacks.append(on_failure)
            elif self._state == 'rejected':
                on_failure(self.reason)
        return self
141976
def _deliver_errored_events(errstream, recs):
    """"""
    rlogger.info("Going to handle %s failed events", len(recs))
    rlogger.info(
        "First failed event: %s", json.dumps(recs[0], indent=4))

    kinesis_stream = errstream.get("kinesis_stream")
    randomkey = str(uuid.uuid4())
    if kinesis_stream:
        send_to_kinesis_stream(
            recs,
            kinesis_stream,
            partition_key=errstream.get("partition_key", randomkey))
        rlogger.info("Sent errors to Kinesis stream '%s'", errstream)

    delivery_stream = errstream.get("firehose_delivery_stream")
    if delivery_stream:
        send_to_delivery_stream(errevents, delivery_stream)
        rlogger.info("Sent error payload to Firehose delivery stream '%s'",
                     delivery_stream)
1294536
def _do_fail_callback(
            self, reason, msg, reply_cb, inform_cb, user_data, timeout_handle):
        """"""
        # this may also result in reply_cb being None if no
        # reply_cb was passed to the request method

        if reply_cb is None:
            # this happens if no reply_cb was passed in to the request
            return

        reason_msg = Message.reply(msg.name, "fail", reason, mid=msg.mid)

        try:
            if user_data is None:
                reply_cb(reason_msg)
            else:
                reply_cb(reason_msg, *user_data)
        except Exception:
            e_type, e_value, trace = sys.exc_info()
            exc_reason = "\n".join(traceback.format_exception(
                e_type, e_value, trace, self._tb_limit))
            self._logger.error("Callback reply during failure %s, %s FAIL: %s" %
                               (reason, msg.name, exc_reason))
1123533
public void onFailure(Throwable t)
    {
        MessagingService.instance().sendOneWay(new SyncComplete(desc, request.src, request.dst, false).createMessage(), request.initiator);
    }
432739
@Override
    public void afterDelivery() throws ResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.entry(tc, "MessageEndpoint.afterDelivery");
        }

        if (!ivSkipCheckState) {
            //method param for checkState can be null since it's only used when the method is a MDB_BUSINESS_METHOD
            checkState(-1, null, AFTER_DELIVERY_METHOD);
        }

        try
        {
            if (ivRollbackOnly) // f743-7046
            {
                ContainerTx currentTx = ivEJSDeployedSupport.getCurrentTx();
                if (currentTx != null) // d629697
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    {
                        Tr.debug(tc, "calling setRollbackOnly");
                    }
                    currentTx.setRollbackOnly(); // f743-7046
                }
            }

            // The container postInvoke will complete the TX if the TX is
            // not an imported global TX. Rollback occurs if setRollbackOnly
            // was invoked on the current TX.
            container.postInvoke(this, ivMethodId, ivEJSDeployedSupport);
        } catch (Throwable e)
        {
            //FFDCFilter.processException(e, CLASS_NAME + ".afterDelivery", "1280", this);
            // f743-7046 start
            if (!ivRollbackOnly) // f743-7046
            {
                FFDCFilter.processException(e, CLASS_NAME + ".afterDelivery", "1280", this);
                throw new ResourceException("afterDelivery failure", e);
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "MessageEndpoint.afterDelivery is eating Throwable: " + e.getMessage()
                                 + " since " + majorJCAVersion + "." + minorJCAVersion + " requires abort of TX and no exceptions to be thrown.", e);
                }
            } // f743-7046 end
        } finally
        {
            // Release objects no longer needed and ensure the
            // rollback only and imported TX flags are reset to false.
            ivRollbackOnly = false; // f743-7046
            ivImportedTx = false; // f743-7046
            ivEJSDeployedSupport = null;
            ivMDB = null;
            ivMethod = null;

            // Enter the ready state.
            synchronized (this)
            {
                ivState = READY_STATE;
                ivThread = null;
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                Tr.exit(tc, "MessageEndpoint.afterDelivery");
            }
        }
    }
1217717
private void flushUpdateQueue() {
        LOG.debug("Run flushUpdateQueue.");

        final int size = queue.size();
        if (size <= 0) {
            return;
        }

        LOG.debug("{} events in flushUpdateQueue.", size);

        final Set<TargetPoll> events = Sets.newHashSetWithExpectedSize(queue.size());
        final int drained = queue.drainTo(events);

        if (drained <= 0) {
            return;
        }

        try {
            events.stream().collect(Collectors.groupingBy(TargetPoll::getTenant)).forEach((tenant, polls) -> {
                final TransactionCallback<Void> createTransaction = status -> updateLastTargetQueries(tenant, polls);
                tenantAware.runAsTenant(tenant,
                        () -> DeploymentHelper.runInNewTransaction(txManager, "flushUpdateQueue", createTransaction));
            });
        } catch (final RuntimeException ex) {
            LOG.error("Failed to persist UpdateQueue content.", ex);
            return;
        }

        LOG.debug("{} events persisted.", drained);
    }
402211
def __notify(self, sender, content):
        
        if self.handle_message is not None:
            try:
                self.handle_message(sender, content)
            except Exception as ex:
                logging.exception("Error calling message listener: %s", ex)
438376
def handle_response(response)
      if response.is_a?(Result)
        token = response.token
        if (result = OperationResult.from_results(response))
          if result.non_delivery?
            @non_delivery_stats.update(result.content.nil? ? "nil" : result.content)
          elsif result.error?
            @result_error_stats.update(result.content.nil? ? "nil" : result.content)
          end
          @result_stats.update(result.status)
        else
          @result_stats.update(response.results.nil? ? "nil" : response.results)
        end

        if (pending_request = @pending_requests[token])
          if result && result.non_delivery? && pending_request.kind == :send_request
            if result.content == OperationResult::TARGET_NOT_CONNECTED
              # Log and temporarily ignore so that timeout retry mechanism continues, but save reason for use below if timeout
              # Leave purging of associated request until final response, i.e., success response or retry timeout
              if (parent_token = pending_request.retry_parent_token)
                @pending_requests[parent_token].non_delivery = result.content
              else
                pending_request.non_delivery = result.content
              end
              Log.info("Non-delivery of <#{token}> because #{result.content}")
            elsif result.content == OperationResult::RETRY_TIMEOUT && pending_request.non_delivery
              # Request timed out but due to another non-delivery reason, so use that reason since more germane
              response.results = OperationResult.non_delivery(pending_request.non_delivery)
              deliver_response(response, pending_request)
            else
              deliver_response(response, pending_request)
            end
          else
            deliver_response(response, pending_request)
          end
        elsif result && result.non_delivery?
          Log.info("Non-delivery of <#{token}> because #{result.content}")
        else
          Log.debug("No pending request for response #{response.to_s([])}")
        end
      end
      true
    end
240855
def _handle_result(self):
        
        result = self.inbox.get()
        if result.success:
            if self._verbosity >= VERB_PROGRESS:
                sys.stderr.write("\nuploaded chunk {} \n".format(result.index))
            self.results.append((result.index, result.md5))
            self._pending_chunks -= 1
        else:
            raise result.traceback
792193
function failure(item, err, ctx) {
		item.count++;
		item.failures++;

		checkThreshold(item, ctx);
	}
721970
function (callback) {
    return function (err, stdout, stderr) {
        if (err) {
            throw err;
        } else if (stderr) {
            log('sync error', 'failed with the following output:');
            console.log('\n', stderr, '\n');
        } else {
            log('sync', 'completed successfully');
            log();
            if (callback) callback();
        }
    };
}
595695
def flush(self):
        """"""
        self._buffer += self._decoder.decode(b"", final=True)
        if self._buffer:
            if self._print:
                print(self._buffer)
            if self._callback:
                self._callback(self._buffer)
        self._buffer = ""
675616
protected function ensureValidResult() {
        $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($this->instanceCache[$this->currentInstance]);
       try {
           $deliveryExecution->getDelivery();
       } catch (\common_exception_NotFound $e) {
           $message = 'Skip result '. $deliveryExecution->getIdentifier(). ' with message '.$e->getMessage();
           \common_Logger::e($message);
           $this->next();
       }
    }
1355265
function messageResend(details, callback) {
        createsend.post('transactional/messages/'+details.messageID+'/resend', null, null, function(error, results) {
            txResponseCallback(error, results, callback);
        }, true);
    }
1280284
@Override
	public void deliverResult(Cursor cursor) {
		if (isReset()) {
			// An async query came in while the loader is stopped
			if (cursor != null) {
				cursor.close();
			}
			return;
		}
		Cursor oldCursor = mCursor;
		mCursor = cursor;

		if (isStarted()) {
			super.deliverResult(cursor);
		}

		if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
			oldCursor.close();
		}
	}