Activate all topic subscriptions for the given clientID.
439519
public void activate(String clientID) {
        for (Subscription s : m_subscriptions) {
            if (s.clientId.equals(clientID)) {
                s.setActive(true);
            }
        }

        //go deep
        for (TreeNode child : m_children) {
            child.activate(clientID);
        }

    }
356590
def subscribe(self,topic,callback=None,options=None):
        
        full_topic = self.get_full_uri(topic)
        result = self.send_and_await_response(SUBSCRIBE(
                                    options=options or {},
                                    topic=full_topic
                                ))
        if result == WAMP_SUBSCRIBED:
            if not callback:
                callback = lambda a: None
            self._subscriptions[result.subscription_id] = [topic,callback]
92775
def update_subscription(self, subscription_id, url=None, events=None):
        
        params = {}

        if url is not None:
            params['url'] = url

        if events is not None:
            params['events'] = events

        url = self.SUBSCRIPTIONS_ID_URL % subscription_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_header('Content-Type', 'application/json')
        connection.add_params(params)

        return connection.patch_request()
1251926
public boolean register( String clientID , String subscriptionName )
	{
		String key = clientID+"-"+subscriptionName;
		synchronized (subscriptions)
		{
			if (subscriptions.containsKey(key))
				return false;
			
			subscriptions.put(key, new DurableTopicSubscription(System.currentTimeMillis(),
					                                            clientID,
					                                            subscriptionName));
			return true;
		}
	}
1067684
def subscribe(TopicArn=None, Protocol=None, Endpoint=None,
              region=None, key=None, keyid=None, profile=None, **kwargs):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    kwargs = {k: v for k, v in kwargs.items() if not k.startswith('_')}
    ## Begin warn_until()
    if any((TopicArn, Protocol, Endpoint)):
        if all((TopicArn, Protocol, Endpoint)):
            salt.utils.versions.warn_until('Sodium', 'Passing positional parameters is deprecated.'
                                           '  Please update code to use keyword style arguments'
                                           ' instead.  This will become mandatory in salt version'
                                           ' {version}.')
            kwargs.update({'TopicArn': TopicArn, 'Protocol': Protocol, 'Endpoint': Endpoint})
        else:
            ## Previous function def required EXACTLY three args
            raise SaltInvocationError('When passed as positional parameters, all three of '
                                      '`TopicArn`, `Protocol`, and `Endpoint` are required.')
    ## End warn_until()
    for arg in ('TopicArn', 'Protocol', 'Endpoint'):
        if arg not in kwargs:
            raise SaltInvocationError('`{}` is a required parameter.'.format(arg))
    try:
        ret = conn.subscribe(**kwargs)
        log.info('Subscribed %s %s to topic %s with SubscriptionArn %s', kwargs['Protocol'],
                 kwargs['Endpoint'], kwargs['TopicArn'], ret['SubscriptionArn'])
        return ret['SubscriptionArn']
    except botocore.exceptions.ClientError as e:
        log.error('Failed to create subscription to SNS topic %s: %s', kwargs['TopicArn'], e)
        return None
    except KeyError:
        log.error('Failed to create subscription to SNS topic %s', kwargs['TopicArn'])
        return None
1272657
def add_subscription(topic, klass, options=nil)
      options ||= {}
      raise WampRails::Error.new('"add_subscription" must be called BEFORE "open"') if self.thread
      self.subscriptions << WampRails::Command::Subscribe.new(topic, klass, options, self)
    end
1135773
def _bind_topics(self, topics):
        

        # FIXME: Allow for these subscriptions to fail and clean up the previous ones
        # so that this function is atomic

        self.client.subscribe(topics.status, self._on_status_message)
        self.client.subscribe(topics.tracing, self._on_trace)
        self.client.subscribe(topics.streaming, self._on_report)
        self.client.subscribe(topics.response, self._on_response_message)
876285
def get_all_subscriptions_by_topic(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    cache_key = _subscriptions_cache_key(name)
    try:
        return __context__[cache_key]
    except KeyError:
        pass

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    ret = conn.get_all_subscriptions_by_topic(get_arn(name, region, key, keyid, profile))
    __context__[cache_key] = ret['ListSubscriptionsByTopicResponse']['ListSubscriptionsByTopicResult']['Subscriptions']
    return __context__[cache_key]
419568
def subscribe(self, topic, callback, qos):
        """"""
        if topic in self.topics:
            return

        def _message_callback(mqttc, userdata, msg):
            """Callback added to callback list for received message."""
            callback(msg.topic, msg.payload.decode('utf-8'), msg.qos)

        self._mqttc.subscribe(topic, qos)
        self._mqttc.message_callback_add(topic, _message_callback)
        self.topics[topic] = callback
434446
protected void sendUnsubscribe(String topic) {
    JsonObject msg = Json.createObject().set(TYPE, "unregister").set(TOPIC, topic);
    send(msg);
  }
1199184
void deactivate(String clientID) {
        for (Subscription s : m_subscriptions) {
            if (s.clientId.equals(clientID)) {
                s.setActive(false);
            }
        }

        //go deep
        for (TreeNode child : m_children) {
            child.deactivate(clientID);
        }
    }
946531
def start (self):
        '''
        

        '''
        self.sub = rospy.Subscriber(self.topic, BumperEvent, self.__callback)
838804
protected void addSubscription(SIBUuid12 topicSpace, String topic, MESubscription subscription)
  {
    // Generate a key for the topicSpace/topic
    final String key = BusGroup.subscriptionKey(topicSpace, topic);

    iProxies.put(key, subscription);
  }
1279137
function unsubscribe(name, id, callback) {
        if (typeof name !== s_string) {
            throw new TypeError('topic name must be a string.');
        }
        if (id === undefined || id === null) {
            if (typeof callback === s_function) {
                id = callback;
            }
            else {
                delete _topics[name];
                return;
            }
        }
        if (typeof id === s_function) {
            callback = id;
            id = null;
        }
        if (id === null) {
            if (_id === null) {
                if (_topics[name]) {
                    var topics = _topics[name];
                    for (id in topics) {
                        delTopic(topics, id, callback);
                    }
                }
            }
            else {
                _id.then(function(id) {
                    unsubscribe(name, id, callback);
                });
            }
        }
        else if (Future.isPromise(id)) {
            id.then(function(id) {
                unsubscribe(name, id, callback);
            });
        }
        else {
            delTopic(_topics[name], id, callback);
        }
        if (isObjectEmpty(_topics[name])) {
            delete _topics[name];
        }
    }
226597
def subscribe(*topics)
      # Create topic partition list with topics and no partition set
      tpl = TopicPartitionList.new_native_tpl(topics.length)

      topics.each do |topic|
        Rdkafka::Bindings.rd_kafka_topic_partition_list_add(
          tpl,
          topic,
          -1
        )
      end
      # Subscribe to topic partition list and check this was successful
      response = Rdkafka::Bindings.rd_kafka_subscribe(@native_kafka, tpl)
      if response != 0
        raise Rdkafka::RdkafkaError.new(response, "Error subscribing to '#{topics.join(', ')}'")
      end
    end
1015971
protected void subscribe( String id, MessagingContext ctx ) throws IOException {

		if( ! canProceed())
			return;

		Set<MessagingContext> sub = this.routingContext.subscriptions.get( id );
		if( sub == null ) {
			sub = new HashSet<> ();
			this.routingContext.subscriptions.put( id, sub );
		}

		sub.add( ctx );
	}
879458
def subscribe(self, destination, id, ack='auto', headers=None, **keyword_headers):
        
        self.transport.subscriptions[id] = destination