Subscribes to specified subscription (note: this can be different from collection)
@param subscriptionName name of subscription
@param params parameters for subscription function (e.g., doc ID, etc.)
@return subscription ID
341721
public int subscribe(final String subscriptionName, Object[] params) {
        // add the subscription to the HashMap with its initial value "false" which says that it is not ready
        subscriptionsAreReady.put(subscriptionName, false);
        
        // subscribe to a Meteor collection with given params
        // test error handling for invalid subscription
        return getDDP().subscribe(subscriptionName, params, new DDPListener() {
            @Override
            public void onReady(String id) {
                // mark subscription ready
                subscriptionsAreReady.replace(subscriptionName, true);

                // broadcast that subscription has been updated
                broadcastSubscriptionChanged(subscriptionName,
                        DdpMessageType.READY, null);
            }

            @Override
            public void onResult(Map<String, Object> jsonFields) {
                String msgtype = (String) jsonFields
                        .get(DdpMessageField.MSG);
                // ignore {"server_id":"GqrKrbcSeDfTYDkzQ"} web socket msgs
                if ((msgtype != null) && (msgtype.equals(DdpMessageType.ERROR))) {
                    broadcastDDPError((String) jsonFields
                            .get(DdpMessageField.ERRORMSG));
                }
            }
        });
    }
233354
public Subscription findSubscriptionByAuthorizationToken(String authorizationToken) {
        EntityManager entityManager = getEntityManager();
        try {
			return entityManager
					.createQuery(
							"SELECT subscription FROM Subscription AS subscription WHERE authorizationToken = :authorizationToken",
							Subscription.class)
					.setParameter("authorizationToken", authorizationToken).setMaxResults(1)
					.getSingleResult();
		} catch (NoResultException e) {
			return null;
		} finally {
			entityManager.close();
		}
	}
1114835
public OvhPrice hpcspot_account_subscription_subscriptionName_GET(net.minidev.ovh.api.price.hpcspot.account.OvhSubscriptionEnum subscriptionName) throws IOException {
		String qPath = "/price/hpcspot/account/subscription/{subscriptionName}";
		StringBuilder sb = path(qPath, subscriptionName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPrice.class);
	}
909617
public Subscription getSubscription(Reference reference) {
		return getResourceFactory().getApiResource(
				"/subscription/" + reference.toURLFragment(false)).get(
				Subscription.class);
	}
2585
public Observable<ServiceResponse<Void>> registerWithServiceResponseAsync(String userName) {
        if (userName == null) {
            throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        final String registrationCode = null;
        RegisterPayload registerPayload = new RegisterPayload();
        registerPayload.withRegistrationCode(null);
        return service.register(userName, this.client.apiVersion(), this.client.acceptLanguage(), registerPayload, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
                @Override
                public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<Void> clientResponse = registerDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
666108
def remove(self, parameters):
        

        # Verify that we already know our assigned subscription_id
        assert self.subscription_id != -1

        if not parameters:
            return

        options = web_pb2.ParameterSubscriptionRequest()
        options.subscriptionId = self.subscription_id
        options.id.extend(_build_named_object_ids(parameters))

        self._manager.send('unsubscribe', options)
597544
public SubscriptionBuilder subscription(String applicationName, Set<String> eventNames) throws IOException {
        return new SubscriptionBuilder(this, applicationName, eventNames);
    }
810606
private ControllableSubscription getSubscription(String id) 
  throws SIMPControllableNotFoundException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getSubscription", id);
      
    //id is assumed to be SIBUuid12
    SIBUuid12 uuid = new SIBUuid12(id);
    SubscriptionTypeFilter filter = new SubscriptionTypeFilter();
    filter.LOCAL = Boolean.TRUE;
    ControllableSubscription sub = getSubscriptionIndex().findByUuid(uuid, filter);
    
    // If the sub is null, throw an exception
    if (sub == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(
          tc,
          "getLocalSubscriptionControlByID",
          "SIMPControllableNotFoundException");
          
      throw new SIMPControllableNotFoundException(
        nls.getFormattedMessage(
          "SUBSCRIPTION_NOT_FOUND_ERROR_CWSIP0271",
          new Object[]{id},
          null));  
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getSubscription", sub);
    
    return sub;
  }
1127379
public Policy replaceSubscriptionPolicy(String subscriptionId) throws Exception {
    // [START pubsub_set_subscription_policy]
    try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
      ProjectSubscriptionName subscriptionName =
          ProjectSubscriptionName.of(projectId, subscriptionId);
      Policy policy = subscriptionAdminClient.getIamPolicy(subscriptionName.toString());
      // Create a role => members binding
      Binding binding =
          Binding.newBuilder()
              .setRole(Role.viewer().toString())
              .addMembers(Identity.allAuthenticatedUsers().toString())
              .build();
      // Update policy
      Policy updatedPolicy = policy.toBuilder().addBindings(binding).build();

      updatedPolicy =
          subscriptionAdminClient.setIamPolicy(subscriptionName.toString(), updatedPolicy);
      return updatedPolicy;
    }
    // [END pubsub_set_subscription_policy]
  }
255518
public ApiResponse<SubscriptionEnvelope> getSubscriptionWithHttpInfo(String subId) throws ApiException {
        com.squareup.okhttp.Call call = getSubscriptionValidateBeforeCall(subId, null, null);
        Type localVarReturnType = new TypeToken<SubscriptionEnvelope>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
24635
public boolean unregister( String clientID , String subscriptionName  )
	{
		String key = clientID+"-"+subscriptionName;
		return subscriptions.remove(key) != null;
	}
1127385
@Override
    public String getSubscribeId(String fname) throws PortalException {

        // see if a given subscribe id is already in the map
        String subId = mFnameMap.get(fname);
        if (subId == null) {
            // see if a given subscribe id is already in the layout
            subId = man.getSubscribeId(fname);
        }

        // obtain a description of the transient channel and
        // assign a new transient channel id
        if (subId == null) {
            try {
                IPortletDefinition chanDef =
                        PortletDefinitionRegistryLocator.getPortletDefinitionRegistry()
                                .getPortletDefinitionByFname(fname);
                if (chanDef != null) {
                    // assign a new id
                    subId = getNextSubscribeId();
                    mFnameMap.put(fname, subId);
                    mSubIdMap.put(subId, fname);
                    mChanMap.put(subId, chanDef);
                }
            } catch (Exception e) {
                log.error(
                        "TransientUserLayoutManagerWrapper::getSubscribeId() : "
                                + "an exception encountered while trying to obtain "
                                + "ChannelDefinition for fname \""
                                + fname
                                + "\" : "
                                + e);
                subId = null;
            }
        }
        return subId;
    }
645409
def create_subscription(subscription_params = {})
      created_at = Time.current
      if subscription_params[:subscribing] == false && subscription_params[:subscribing_to_email].nil?
        subscription_params[:subscribing_to_email] = subscription_params[:subscribing] 
      end
      subscription = subscriptions.new(subscription_params)
      subscription.subscribing? ?
        subscription.assign_attributes(subscribing: true, subscribed_at: created_at) :
        subscription.assign_attributes(subscribing: false, unsubscribed_at: created_at)
      subscription.subscribing_to_email? ?
        subscription.assign_attributes(subscribing_to_email: true, subscribed_to_email_at: created_at) :
        subscription.assign_attributes(subscribing_to_email: false, unsubscribed_to_email_at: created_at)
      subscription.optional_targets = (subscription.optional_targets || {}).with_indifferent_access
      optional_targets = {}.with_indifferent_access
      subscription.optional_target_names.each do |optional_target_name|
        optional_targets = subscription.subscribing_to_optional_target?(optional_target_name) ?
          optional_targets.merge(
            Subscription.to_optional_target_key(optional_target_name) => true,
            Subscription.to_optional_target_subscribed_at_key(optional_target_name) => created_at
          ) :
          optional_targets.merge(
            Subscription.to_optional_target_key(optional_target_name) => false,
            Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => created_at
          )
      end
      subscription.assign_attributes(optional_targets: optional_targets)
      subscription.save ? subscription : nil
    end
464522
protected MESubscription getSubscription(SIBUuid12 topicSpace, String topic)
  {
    return (MESubscription)iProxies.get(BusGroup.subscriptionKey(topicSpace, topic));
  }
857269
@Deprecated
    public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException {
        return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe();
    }
709991
public Subscription reactivateSubscription(final Subscription subscription) {
        return doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/reactivate",
                     subscription, Subscription.class);
    }
607016
function () {
            /*  determine parameters  */
            var params = $cs.params("subscribe", arguments, {
                name:      { pos: 0,     req: true  },
                spec:      {             def: {}    },
                ctx:       {             def: this  },
                func:      { pos: 1,     req: true  },
                args:      { pos: "...", def: []    },
                capturing: {             def: false },
                spreading: {             def: false },
                bubbling:  {             def: true  },
                noevent:   {             def: false },
                exclusive: {             def: false },
                spool:     {             def: null  }
            });

            /*  honor exclusive request
                (attention: name can also be a regular expression object!)  */
            var subscriptions = this._subscriptions(params.name.toString(), params.spec);
            if (subscriptions.length === 1 && subscriptions[0].exclusive)
                throw _cs.exception("subscribe", "existing exclusive subscription prevents additional one");
            if (params.exclusive && subscriptions.length > 0)
                throw _cs.exception("subscribe", "non-exclusive subscription(s) prevent exclusive one");

            /*  attach parameters to component  */
            var id = _cs.cid();
            this.__subscription[id] = params;

            /*  optionally spool reverse operation  */
            if (params.spool !== null) {
                var info = _cs.spool_spec_parse(this, params.spool);
                info.comp.spool(info.name, this, "unsubscribe", id);
            }

            return id;
        }