Newsletter subscriber service
430237
protected function registerSubscribeWorkerService(){

        $this->app->bind('designpond\newsletter\Newsletter\Worker\SubscriptionWorkerInterface', function()
        {
            return new \designpond\newsletter\Newsletter\Worker\SubscriptionWorker(
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterInterface'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterUserInterface'),
                \App::make('designpond\newsletter\Newsletter\Worker\MailjetServiceInterface')
            );
        });
    }
700144
def subscribe_to_chat(
        self,
        subscriber: Callable[[events.ChatMessageWasReceived], None],
    ) -> None:
        
        self._chat_subscribers.append(subscriber)
1111609
function subscribeOn(scheduler, delay) {
    if (delay === void 0) {
        delay = 0;
    }
    return function subscribeOnOperatorFunction(source) {
        return source.lift(new SubscribeOnOperator(scheduler, delay));
    };
}
110928
private function processGeneralSubscription()
    {
        $customerId = $this->customerSession->getCustomerId();
        if ($customerId === null) {
            $this->messageManager->addError(__('Something went wrong while saving your subscription.'));
        } else {
            try {
                $customer = $this->customerRepository->getById($customerId);
                $storeId = $this->helper->storeManager->getStore()->getId();
                $customer->setStoreId($storeId);
                $isSubscribedState = $customer->getExtensionAttributes()
                    ->getIsSubscribed();
                $isSubscribedParam = (boolean)$this->getRequest()
                    ->getParam('is_subscribed', false);
                if ($isSubscribedParam !== $isSubscribedState) {
                    $this->customerRepository->save($customer);
                    if ($isSubscribedParam) {
                        $subscribeModel = $this->subscriberFactory->create()
                            ->subscribeCustomerById($customerId);
                        $subscribeStatus = $subscribeModel->getStatus();
                        if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) {
                            $this->messageManager->addSuccess(__('We have saved your subscription.'));
                        } else {
                            $this->messageManager->addSuccess(__('A confirmation request has been sent.'));
                        }
                    } else {
                        $this->subscriberFactory->create()
                            ->unsubscribeCustomerById($customerId);
                        $this->messageManager->addSuccess(__('We have removed your newsletter subscription.'));
                    }
                } else {
                    $this->messageManager->addSuccess(__('We have updated your subscription.'));
                }
            } catch (\Exception $e) {
                $this->messageManager->addError(__('Something went wrong while saving your subscription.'));
            }
        }
    }
1144648
function (fn) {
  var container = this;

  var program = function () {
    var subscriber = new Subscription(fn, null, container);
    return subscriber.execute.apply(subscriber, arguments);
  };

  Utils.extend(program, fn);

  return program;
}
1322844
def subscribe(self, topic, qos):
        """"""
        if self.sock == NC.INVALID_SOCKET:
            return NC.ERR_NO_CONN
        
        self.logger.info("SUBSCRIBE: %s", topic)
        return self.send_subscribe(False, [(utf8encode(topic), qos)])
1147287
def subscribe(self, event):
        """"""
        uuids = event.data

        if not isinstance(uuids, list):
            uuids = [uuids]

        subscribed = []
        for uuid in uuids:
            try:
                self._add_subscription(uuid, event)
                subscribed.append(uuid)
            except KeyError:
                continue

        result = {
            'component': 'hfos.events.objectmanager',
            'action': 'subscribe',
            'data': {
                'uuid': subscribed, 'success': True
            }
        }
        self._respond(None, result, event)
1027291
def start_subscribe(self):
        """"""
        if not self.conn:
            raise ValueError('Not connected')
        elif not self.pubsub_conn:
            raise ValueError('PubSub not enabled')

        # creates a new context manager
        return Subscription(self)
951937
function (event) {
    this.debug("Requesting subscription for " + event);
    sendReceive.call(this, {'do': 'subscribe', params: [event]}, function (result) {
        if (result.success) {
            this.debug("Succesfully subscribed to %s", event);
        } else {
            this.debug("Subscription request for %s failed", event);
        }
    });
    this.subscribedEvents.push(event);
}
934797
def startSubscription(self, reqId, subscriber, contract=None):
        
        self._reqId2Contract[reqId] = contract
        self.reqId2Subscriber[reqId] = subscriber
755460
public function createSubscription()
    {
        $data = [
            "customer" => request()->customer, //Customer email or code
            "plan" => request()->plan,
            "authorization" => request()->authorization_code
        ];

        $this->setRequestOptions();
        $this->setHttpResponse('/subscription', 'POST', $data);
    }
681012
def addSubscriber(self, email):
        

        headers, raw_data = self._perform_subscribe()
        existed_flag, raw_data = self._add_subscriber(email, raw_data)
        if existed_flag:
            return

        self._update_subscribe(headers, raw_data)
        self.log.info("Successfully add a subscriber: %s for <Workitem %s>",
                      email, self)
1013348
def create_subscriber(self):
        '''
        '''
        if self.subscriber is None:
            if self.topics:
                self.subscriber = NSSubscriber(self.services, self.topics,
                                               addr_listener=True,
                                               addresses=self.addresses,
                                               nameserver=self.nameserver)
                self.recv = self.subscriber.start().recv
1046054
def subscribe(ws):
    """"""
    while ws is not None:
        gevent.sleep(0.1)
        try:
            message = ws.receive()  # expect function name to subscribe to
            if message:
                stream.register(ws, message)
        except WebSocketError:
            ws = None
3064
def subscribe(self, receiver):
        ""
        log.debug('{0}.{1} subscribe to {2}'
                  .format(receiver.__module__, receiver.__name__, self))
        self.signal.connect(receiver)
121923
def event_subscription(event)
      ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data|
        filtered_data = data.slice(*event[:allowed_data])
        filtered_data[:event_name] = event[:id]
        filtered_data[:event_id] = event_id
        if event[:id] == "sql.active_record"
          binds = data[:binds].each_with_object({}) { |bind, output| output[bind.name] = '?' if defined?(bind.name) }
          filtered_data[:binds] = JSON.dump(binds) unless binds.empty?
        end
        Bugsnag.leave_breadcrumb(
          event[:message],
          filtered_data,
          event[:type],
          :auto
        )
      end
    end
1067800
def subscribe(self, topic, channel):
        """"""
        self.send(nsq.subscribe(topic, channel))