Observe an endpoint.
968708
async def _observe(self, api_command):
        """"""
        duration = api_command.observe_duration
        url = api_command.url(self._host)
        err_callback = api_command.err_callback

        msg = Message(code=Code.GET, uri=url, observe=duration)

        # Note that this is necessary to start observing
        pr, r = await self._get_response(msg)

        api_command.result = _process_output(r)

        def success_callback(res):
            api_command.result = _process_output(res)

        def error_callback(ex):
            err_callback(ex)

        ob = pr.observation
        ob.register_callback(success_callback)
        ob.register_errback(error_callback)
        self._observations_err_callbacks.append(ob.error)
1210898
boolean registerEndpoint(String addr, Endpoint endpoint)
    {
        endpointsSync.lock();

        Endpoint inserted = null;
        try {
            inserted = endpoints.put(addr, endpoint);
        }
        finally {
            endpointsSync.unlock();
        }
        if (inserted != null) {
            return false;
        }
        return true;
    }
550041
def _subscription_thread(self, endpoint):
        
        try:
            conn = create_connection(self.addr + endpoint, timeout=5)
        except WebSocketTimeoutException:
            self.restart_q.put(endpoint)
            return

        while self.threads_running[endpoint]:
            try:
                msg = conn.recv()
            except WebSocketTimeoutException:
                self._controller_q.put(endpoint)

            log.debug("%s, %s", endpoint, msg)
            ep, pair = endpoint.split('/')
            log.debug("_subscription_thread(): Putting data on q..")
            try:
                self.data_q.put((ep, pair, msg, time.time()), timeout=1)
            except TimeoutError:
                continue
            finally:
                log.debug("_subscription_thread(): Data Processed, looping back..")
        conn.close()
        log.debug("_subscription_thread(): Thread Loop Ended.")
408365
def update_endpoint(self, endpoint):
        
        self._validate_uuid(endpoint.endpoint_id)
        self._validate_subscriber_id(endpoint.subscriber_id)

        url = "/notification/v1/endpoint/{}".format(endpoint.endpoint_id)
        response = NWS_DAO().putURL(
            url, self._write_headers(), self._json_body(endpoint.json_data()))

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)
        return response.status
1177223
def endpoint(self, value):
        # type: (StorageAccount, str) -> None
        
        tmp = value.split('.')
        if (len(tmp) <= 1 or not tmp[0].isalnum()):
            raise ValueError('endpoint is invalid: {}'.format(value))
        self._endpoint = value
693967
def locate_endpoint_function(self, name=None):
        ''
        if name is not None:
            ep = "%s_%s" %(self._base_pathname,
                           name)
        else:
            ep = self._base_pathname
        return self._notflask.endpoints[ep]['view_func']
864606
def fetch(self, endpoint, data = None):
        
        payload = {
            "lastServerChangeId": "-1",
            "csrf": self.__csrf,
            "apiClient": "WEB"
        }
        if data is not None:
            payload.update(data)

        return self.post(endpoint, payload)
337694
def endpoint(request):
    """"""
    # pylint: disable=too-many-return-statements,too-many-branches

    # In order to 'hide' the endpoint, all non-POST requests should return
    # the site's default HTTP404
    if request.method != 'POST':
        raise Http404

    # If necessary, check that the topic is correct
    if hasattr(settings, 'BOUNCY_TOPIC_ARN'):
        # Confirm that the proper topic header was sent
        if 'HTTP_X_AMZ_SNS_TOPIC_ARN' not in request.META:
            return HttpResponseBadRequest('No TopicArn Header')

        # Check to see if the topic is in the settings
        # Because you can have bounces and complaints coming from multiple
        # topics, BOUNCY_TOPIC_ARN is a list
        if (not request.META['HTTP_X_AMZ_SNS_TOPIC_ARN']
                in settings.BOUNCY_TOPIC_ARN):
            return HttpResponseBadRequest('Bad Topic')

    # Load the JSON POST Body
    if isinstance(request.body, str):
        # requests return str in python 2.7
        request_body = request.body
    else:
        # and return bytes in python 3.4
        request_body = request.body.decode()
    try:
        data = json.loads(request_body)
    except ValueError:
        logger.warning('Notification Not Valid JSON: {}'.format(request_body))
        return HttpResponseBadRequest('Not Valid JSON')

    # Ensure that the JSON we're provided contains all the keys we expect
    # Comparison code from http://stackoverflow.com/questions/1285911/
    if not set(VITAL_NOTIFICATION_FIELDS) <= set(data):
        logger.warning('Request Missing Necessary Keys')
        return HttpResponseBadRequest('Request Missing Necessary Keys')

    # Ensure that the type of notification is one we'll accept
    if not data['Type'] in ALLOWED_TYPES:
        logger.info('Notification Type Not Known %s', data['Type'])
        return HttpResponseBadRequest('Unknown Notification Type')

    # Confirm that the signing certificate is hosted on a correct domain
    # AWS by default uses sns.{region}.amazonaws.com
    # On the off chance you need this to be a different domain, allow the
    # regex to be overridden in settings
    domain = urlparse(data['SigningCertURL']).netloc
    pattern = getattr(
        settings, 'BOUNCY_CERT_DOMAIN_REGEX', r"sns.[a-z0-9\-]+.amazonaws.com$"
    )
    if not re.search(pattern, domain):
        logger.warning(
            'Improper Certificate Location %s', data['SigningCertURL'])
        return HttpResponseBadRequest('Improper Certificate Location')

    # Verify that the notification is signed by Amazon
    if (getattr(settings, 'BOUNCY_VERIFY_CERTIFICATE', True)
            and not verify_notification(data)):
        logger.error('Verification Failure %s', )
        return HttpResponseBadRequest('Improper Signature')

    # Send a signal to say a valid notification has been received
    signals.notification.send(
        sender='bouncy_endpoint', notification=data, request=request)

    # Handle subscription-based messages.
    if data['Type'] == 'SubscriptionConfirmation':
        # Allow the disabling of the auto-subscription feature
        if not getattr(settings, 'BOUNCY_AUTO_SUBSCRIBE', True):
            raise Http404
        return approve_subscription(data)
    elif data['Type'] == 'UnsubscribeConfirmation':
        # We won't handle unsubscribe requests here. Return a 200 status code
        # so Amazon won't redeliver the request. If you want to remove this
        # endpoint, remove it either via the API or the AWS Console
        logger.info('UnsubscribeConfirmation Not Handled')
        return HttpResponse('UnsubscribeConfirmation Not Handled')

    try:
        message = json.loads(data['Message'])
    except ValueError:
        # This message is not JSON. But we need to return a 200 status code
        # so that Amazon doesn't attempt to deliver the message again
        logger.info('Non-Valid JSON Message Received')
        return HttpResponse('Message is not valid JSON')

    return process_message(message, data)
1074975
def watch(self):
        """"""
        return bool(lib.EnvGetDefmessageHandlerWatch(
            self._env, self._cls, self._idx))
1326015
private void ensureMinimum() {
        int belowMin = minEndpoints - endpoints.size();
        if (belowMin > 0) {
            LOGGER.debug(logIdent(hostname, this) + "Service is {} below minimum, filling up.", belowMin);

            synchronized (epMutex) {
                for (int i = 0; i < belowMin; i++) {
                    Endpoint endpoint = endpointFactory.create(hostname, bucket, username, password, port, ctx);
                    endpoints.add(endpoint);
                    endpointStates.register(endpoint, endpoint);
                    endpoint.connect().subscribe(new Subscriber<LifecycleState>() {
                        @Override
                        public void onCompleted() { /* ignored on purpose */ }

                        @Override
                        public void onError(Throwable e) {
                            LOGGER.warn(logIdent(hostname, PooledService.this)
                                + "Got an error while connecting endpoint!", e);
                        }

                        @Override
                        public void onNext(LifecycleState state) { /* ignored on purpose */ }
                    });
                }

                LOGGER.debug(logIdent(hostname, PooledService.this)
                        + "New number of endpoints is {}", endpoints.size());
            }
        }
    }
544862
def observe(self, key, callback: Callable[[Any, Any], None]):
        """"""
        if key not in self.__dict__ and key not in self._callbacks:
            raise KeyError('Entity ' + str(self) + 'doesn''t have attribute' + key)
        super().observe(key, callback)
1155363
def listen(cls, event, func):
        """"""
        signal(event).connect(func, sender=cls)
729740
def endpoint(url):
    """"""
    if not url:
        click.secho(dtool_config.utils.get_ecs_endpoint(CONFIG_PATH))
    else:
        click.secho(dtool_config.utils.set_ecs_endpoint(CONFIG_PATH, url))
145513
function observe (value) {
	  if (!isObject(value)) {
	    return
	  }
	  var ob;
	  if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
	    ob = value.__ob__;
	  } else if (
	    observerState.shouldConvert &&
	    !config._isServer &&
	    (Array.isArray(value) || isPlainObject(value)) &&
	    Object.isExtensible(value) &&
	    !value._isVue
	  ) {
	    ob = new Observer(value);
	  }
	  return ob
	}
248153
def observe_all(self, callback: Callable[[str, Any, Any], None]):
        """"""
        self._all_callbacks.append(callback)
79111
public function listEndpoints() {
    $uri = new URIResource($this->path, array($this->id, "endpoints"));

    return new EndpointsCollection(new DataPacketCollection($this->client->get((string) $uri)));
  }
504628
public function consume(EndpointInterface $endpoint)
    {
        $this->initialize($endpoint);

        while (!$this->shouldStop()) {
            try {
                // Receive
                $message = $this->readMessage($endpoint);

                // Process
                if ($message) {
                    $startConsumeTime = microtime(true);

                    --$this->expirationCount;

                    $this->process($endpoint, $message);

                    $this->logConsumeMessage();

                    $this->confirmMessage($endpoint, $message);

                    $endConsumeTime = microtime(true);
                    $this->dispatchConsumerTimingEvent((int) (($endConsumeTime - $startConsumeTime) * 1000), $message);
                }
            } catch (\Exception $ex) {
                if (!$this->stop) {
                    throw $ex;
                }
            }
        }

        $this->cleanUp($endpoint);
    }