Calls user-provided callback and marks message for Ack regardless of success
763005
def __recv_cb(self, msg):
        
        try:
            self.__msg_callback(msg)
        except:
            logger.exception("AmqpLink.__recv_cb exception calling msg_callback")
        finally:
            # only works if all messages handled in series
            self.__last_id = msg.delivery_tag
            self.__unacked += 1
798981
def msg_callback(self, callback):
        """"""
        if callable(callback):
            self._msg_callback = callback
        else:
            self._msg_callback = None
548683
def alwaysCalledWith(cls, spy, *args, **kwargs): #pylint: disable=invalid-name
        
        cls.__is_spy(spy)
        if not (spy.alwaysCalledWith(*args, **kwargs)):
            raise cls.failException(cls.message)
1071371
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        if (callbacks.length == 1 && callbacks[0] instanceof AuthorizeCallback) {
            AuthorizeCallback acb = (AuthorizeCallback) callbacks[0];
            boolean authorized = acb.getAuthenticationID().equals(acb.getAuthorizationID());
            if (authorized == false) {
                SECURITY_LOGGER.tracef(
                        "Checking 'AuthorizeCallback', authorized=false, authenticationID=%s, authorizationID=%s.",
                        acb.getAuthenticationID(), acb.getAuthorizationID());
            }
            acb.setAuthorized(authorized);

            return;
        }

        NameCallback nameCallBack = null;
        EvidenceVerifyCallback evidenceVerifyCallback = null;
        SubjectCallback subjectCallback = null;

        for (Callback current : callbacks) {
            if (current instanceof NameCallback) {
                nameCallBack = (NameCallback) current;
            } else if (current instanceof RealmCallback) {
            } else if (current instanceof EvidenceVerifyCallback) {
                evidenceVerifyCallback = (EvidenceVerifyCallback) current;
            } else if (current instanceof SubjectCallback) {
                subjectCallback = (SubjectCallback) current;
            } else {
                throw new UnsupportedCallbackException(current);
            }
        }

        if (nameCallBack == null) {
            SECURITY_LOGGER.trace("No username supplied in Callbacks.");
            throw DomainManagementLogger.ROOT_LOGGER.noUsername();
        }
        final String userName = nameCallBack.getDefaultName();
        if (userName == null || userName.length() == 0) {
            SECURITY_LOGGER.trace("NameCallback either has no username or is 0 length.");
            throw DomainManagementLogger.ROOT_LOGGER.noUsername();
        }
        if (evidenceVerifyCallback == null || evidenceVerifyCallback.getEvidence() == null) {
            SECURITY_LOGGER.trace("No password to verify.");
            throw DomainManagementLogger.ROOT_LOGGER.noPassword();
        }

        final char[] password;

        if (evidenceVerifyCallback.getEvidence() instanceof PasswordGuessEvidence) {
            password = ((PasswordGuessEvidence) evidenceVerifyCallback.getEvidence()).getGuess();
        } else {
            SECURITY_LOGGER.trace("No password to verify.");
            throw DomainManagementLogger.ROOT_LOGGER.noPassword();
        }

        Subject subject = subjectCallback != null && subjectCallback.getSubject() != null ? subjectCallback.getSubject()
                : new Subject();
        evidenceVerifyCallback.setVerified(verify(userName, password, subject, subjectCallback != null ? subjectCallback::setSubject : null));
    }
1134526
public void ack(String requestId, String resultMessage) throws TException
    {
        int index = this.requestedMap.remove(requestId);
        DRPCInvocationsClient client = this.clients.get(index);
        client.result(requestId, resultMessage);
    }
442874
private static function _checkCallback($cls, $callback, $context)
    {
        self::_initiateCallbacks($cls);
        foreach (self::$_callbacks[$cls][$callback] as $func) {
            if (!call_user_func(array($context, $func))) {
                return false;
            }
        }
        return true;
    }
529803
def alwaysCalledWithMatch(cls, spy, *args, **kwargs): #pylint: disable=invalid-name
        
        cls.__is_spy(spy)
        if not (spy.alwaysCalledWithMatch(*args, **kwargs)):
            raise cls.failException(cls.message)
3117
private void execCallback(boolean result, EmailBody body, String to, String title,
                              FilePart[] fileParts, Throwable error, JMail mail,
                              JMailCallback callback) {
        if (callback != null) {
            callback.call(result, body, to, title, fileParts, error, mail);
        }
    }
897099
function handleMessage(data) {

      const message = data;

      message.params = that.parser.parse(data);
      message.channel = ch;
      message.ack = ack;

      // Ack method for the msg
      function ack() {
        debug('ack delivery', data.fields.deliveryTag);
        ch.ack(data);
      }

      if (Array.isArray(message)) {
        that.options.handler(message[0]);
      }
      else {
        that.options.handler(message);
      }
      debug('queue', that.options.queue);
      if (that.options.autoAck) {
        debug('autoAck', 'true');
        ack();
      }
    }
755121
def __callback (self, event):
        '''
        

        '''
        bump = bumperEvent2BumperData(event)

        if bump.state == 1:
            self.lock.acquire()
            self.time = current_milli_time()
            self.data = bump
            self.lock.release()
658897
function(eventName, param, ack) {
        try {
          if (ack) {
            for (var id in eventCallbacks[eventName])
              eventCallbacks[eventName][id](param, ack);
          } else {
            for (var id in eventCallbacks[eventName])
              eventCallbacks[eventName][id](param);
          }
        } catch (e) {
          fireEvent("error", {
            errorCode: 999,
            errorMessage: "Unknown ERROR!",
            errorEvent: e
          });
        }
      }
431321
function handleIt(cb) {
    callbacks = cb;
    broadcast = callbacks.broadcast;

    let msg = {
      cmd: MessageType.RockPaperScissors,
      handlerId: id
    };
    broadcast("action", msg);

    // Return a promise for the result
    deferred = q.defer();
    return deferred.promise;
  }
527650
def _acking(self, params=None):
        
        while self._is_running:
            try:
                t, num_try, (ip, port), packet = self._to_ack.get(
                    timeout=self._select_timeout
                )
            except queue.Empty:
                # Timed out
                continue

            diff = t - time.time()
            if diff > 0:
                time.sleep(diff)

            with self._seq_ack_lock:
                if packet.header.sequence_number not in self._seq_ack:
                    # Not waiting for this?
                    continue

            if num_try <= self._retransmit_max_tries:
                # Try again
                self._send(ip, port, packet.pack(True))
                self._to_ack.put(
                    (
                        time.time() + self._retransmit_timeout,
                        num_try + 1,
                        (ip, port),
                        packet
                    )
                )
            else:
                # Failed to ack
                with self._seq_ack_lock:
                    try:
                        self._seq_ack.remove(packet.header.sequence_number)
                    except KeyError:
                        pass
                self.warning("Exceeded max tries")
750547
def ackSoon(self):
        
        if self._ackTimer is None:
            def originateAck():
                self._ackTimer = None
                self.originate(ack=True)
            self._ackTimer = reactor.callLater(0.1, originateAck)
        else:
            self._ackTimer.reset(ACK_DELAY)
268989
def ack(self):
        
        if self.acknowledged:
            raise self.MessageStateError(
                "Message already acknowledged with state: %s" % self._state)
        self.backend.ack(self.delivery_tag)
        self._state = "ACK"
1348704
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        for (Callback c : callbacks) {
            if (c instanceof NameCallback) {
                LOG.debug("name callback");
            } else if (c instanceof PasswordCallback) {
                LOG.debug("password callback");
                LOG.warn("Could not login: the client is being asked for a password, but the "
                        + " client code does not currently support obtaining a password from the user."
                        + " Make sure that the client is configured to use a ticket cache (using"
                        + " the JAAS configuration setting 'useTicketCache=true)' and restart the client. If"
                        + " you still get this message after that, the TGT in the ticket cache has expired and must"
                        + " be manually refreshed. To do so, first determine if you are using a password or a"
                        + " keytab. If the former, run kinit in a Unix shell in the environment of the user who" + " is running this client using the command"
                        + " 'kinit <princ>' (where <princ> is the name of the client's Kerberos principal)." + " If the latter, do"
                        + " 'kinit -k -t <keytab> <princ>' (where <princ> is the name of the Kerberos principal, and"
                        + " <keytab> is the location of the keytab file). After manually refreshing your cache,"
                        + " restart this client. If you continue to see this message after manually refreshing"
                        + " your cache, ensure that your KDC host's clock is in sync with this host's clock.");
            } else if (c instanceof AuthorizeCallback) {
                LOG.debug("authorization callback");
                AuthorizeCallback ac = (AuthorizeCallback) c;
                String authid = ac.getAuthenticationID();
                String authzid = ac.getAuthorizationID();
                if (authid.equals(authzid)) {
                    ac.setAuthorized(true);
                } else {
                    ac.setAuthorized(false);
                }
                if (ac.isAuthorized()) {
                    ac.setAuthorizedID(authzid);
                }
            } else {
                throw new UnsupportedCallbackException(c);
            }
        }
    }
867568
def call(self, name: str, *args, **kwargs):
        ''''''
        if self._event_dispatcher is not None:
            self._event_dispatcher.notify(name, *args, **kwargs)

        if self._callbacks[name]:
            return self._callbacks[name](*args, **kwargs)
        else:
            raise HookDisconnected('No callback is connected.')