Tombstones a specific producer of an existing topic.
765782
def tombstone_topic(self, topic, node):
        """"""
        nsq.assert_valid_topic_name(topic)
        return self._request('POST', '/topic/tombstone',
                             fields={'topic': topic, 'node': node})
385536
def forum_create_topic(self, subject, author, message, tags=""):
        """"""

        params = {'subject': subject, 'author': author, 'message': message, 'tags': tags}

        return self._request('ebuio/forum/', postParams=params, verb='POST')
1286192
function(params, cb) {
    cb = cb || _noop;
    assert(params.topic);

    _metaBroker.metadata([params.topic], function(err, cluster) {
      cluster.topics.forEach(function(topic) {
        _partitions[topic.topicName] = topic.partitions;
      });

      cb(err, cluster);
    });
  }
730816
def copy(self):
        """"""
        c = copy.copy(self)
        c._topics = {}
        c._lock = threading.Lock()
        topics = set(six.iterkeys(self._topics))
        while topics:
            event_type = topics.pop()
            try:
                listeners = self._topics[event_type]
                c._topics[event_type] = list(listeners)
            except KeyError:
                pass
        return c
1137856
function TopicPartition(topic, partition, offset) {
  if (!(this instanceof TopicPartition)) {
    return new TopicPartition(topic, partition, offset);
  }

  // Validate that the elements we are iterating over are actual topic partition
  // js objects. They do not need an offset, but they do need partition
  if (!topic) {
    throw new TypeError('"topic" must be a string and must be set');
  }

  if (partition === null || partition === undefined) {
    throw new TypeError('"partition" must be a number and must set');
  }

  // We can just set topic and partition as they stand.
  this.topic = topic;
  this.partition = partition;

  if (offset === undefined || offset === null) {
    this.offset = Topic.OFFSET_STORED;
  } else if (typeof offset === 'string') {
    switch (offset.toLowerCase()) {
      case 'earliest':
      case 'beginning':
        this.offset = Topic.OFFSET_BEGINNING;
        break;
      case 'latest':
      case 'end':
        this.offset = Topic.OFFSET_END;
        break;
      case 'stored':
        this.offset = Topic.OFFSET_STORED;
        break;
      default:
        throw new TypeError('"offset", if provided as a string, must be beginning, end, or stored.');
    }
  } else if (typeof offset === 'number') {
    this.offset = offset;
  } else {
    throw new TypeError('"offset" must be a special string or number if it is set');
  }
}
917714
protected void populateDatabaseTopics(final BuildData buildData,
            final Map<String, BaseTopicWrapper<?>> topics) throws BuildProcessingException {
        final List<TopicWrapper> allTopics = new ArrayList<TopicWrapper>();
        final List<TopicWrapper> latestTopics = new ArrayList<TopicWrapper>();
        final List<TopicWrapper> revisionTopics = new ArrayList<TopicWrapper>();

        // Calculate the ids of all the topics to get
        final List<ITopicNode> topicNodes = buildData.getContentSpec().getAllTopicNodes();
        for (final ITopicNode topicNode : topicNodes) {
            // Determine which topics we need to fetch the latest topics for and which topics we need to fetch revisions for.
            final TopicWrapper topic;
            if (topicNode.getRevision() != null && !buildData.getBuildOptions().getUseLatestVersions()) {
                topic = topicProvider.getTopic(topicNode.getDBId(), topicNode.getRevision());
                revisionTopics.add(topic);
                allTopics.add(topic);
            } else if (buildData.getBuildOptions().getMaxRevision() != null && !buildData.getBuildOptions().getUseLatestVersions()) {
                topic = topicProvider.getTopic(topicNode.getDBId(), buildData.getBuildOptions().getMaxRevision());
                revisionTopics.add(topic);
                allTopics.add(topic);
            } else {
                topic = topicProvider.getTopic(topicNode.getDBId());
                latestTopics.add(topic);
                allTopics.add(topic);
            }

            // Add the topic to the topics collection
            final String key = DocBookBuildUtilities.getTopicBuildKey(topic);
            topics.put(key, topic);
            buildData.getBuildDatabase().add(topicNode, key);
        }
    }
991571
public void cleanup() {
        ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
        for (ProducerReference p : producerReferences) {
            try {
                if (p.get() != null)
                    unregisterProducer(p.get());
            } catch (Exception e) {
                LOGGER.warn("can't unregister producer " + p, e);
            }
        }
    }
644415
public void addObservationProducer(IObservationProducer producer)
    {
        if (this.producers == null)
        {
            this.producers = new ArrayList<IObservationProducer>();
        }
        this.producers.add(producer);
    }
1216501
def add_topic(self, topic):
        
        if topic in self._topics:
            return Future().success(set(self._topics))

        self._topics.add(topic)
        return self.cluster.request_update()
1294783
def topic(self, channel, new_topic=None, tags=None):
        """"""
        params = [channel]
        if new_topic:
            params += new_topic
        self.send('TOPIC', params=params, source=self.nick, tags=tags)
423758
def maybe_start_recording(tokens, index):
        """"""
        if tokens[index].type == TokenType.BeginRSTComment:
            return _RSTCommentBlockRecorder(index, tokens[index].line)

        return None
651538
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer origMessage, boolean retain, Integer messageID) {
        Log.trace("publish2Subscribers republishing to existing subscribers that matches the topic {}", topic);
        if (Log.DEBUG) {
            Log.trace("content <{}>", DebugUtils.payload2Str(origMessage));
            Log.trace("subscription tree {}", subscriptions.dumpTree());
        }
        for (final Subscription sub : subscriptions.matches(topic)) {
            if(m_clientIDs.get(sub.getClientId()) == null) {
                subscriptions.removeSubscription(topic, sub.getClientId());
                continue;
            }
            if (qos.ordinal() > sub.getRequestedQos().ordinal()) {
                qos = sub.getRequestedQos();
            }

            ByteBuffer message = origMessage.duplicate();

            if (qos == AbstractMessage.QOSType.MOST_ONE && sub.isActive()) {
                //QoS 0
                sendPublish(sub.getClientId(), topic, qos, message, false);
            } else {
                //QoS 1 or 2
                //if the target subscription is not clean session and is not connected => store it
                if (!sub.isCleanSession() && !sub.isActive()) {
                    //clone the event with matching clientID
                    PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
                    m_storageService.storePublishForFuture(newPublishEvt);
                } else  {
                    //if QoS 2 then store it in temp memory
                    if (qos ==AbstractMessage.QOSType.EXACTLY_ONCE) {
                        String publishKey = String.format("%s%d", sub.getClientId(), messageID);
                        PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
                        m_storageService.addInFlight(newPublishEvt, publishKey);
                    }
                    //publish
                    if (sub.isActive()) {
                        sendPublish(sub.getClientId(), topic, qos, message, false);
                    }
                }
            }
        }
    }
1128730
def preprocess_topics(source_groupid, source_topics, dest_groupid, topics_dest_group):
    """"""
    # Is the new consumer already subscribed to any of these topics?
    common_topics = [topic for topic in topics_dest_group if topic in source_topics]
    if common_topics:
        print(
            "Error: Consumer Group ID: {groupid} is already "
            "subscribed to following topics: {topic}.\nPlease delete this "
            "topics from new group before re-running the "
            "command.".format(
                groupid=dest_groupid,
                topic=', '.join(common_topics),
            ),
            file=sys.stderr,
        )
        sys.exit(1)
    # Let's confirm what the user intends to do.
    if topics_dest_group:
        in_str = (
            "New Consumer Group: {dest_groupid} already "
            "exists.\nTopics subscribed to by the consumer groups are listed "
            "below:\n{source_groupid}: {source_group_topics}\n"
            "{dest_groupid}: {dest_group_topics}\nDo you intend to copy into"
            "existing consumer destination-group? (y/n)".format(
                source_groupid=source_groupid,
                source_group_topics=source_topics,
                dest_groupid=dest_groupid,
                dest_group_topics=topics_dest_group,
            )
        )
        prompt_user_input(in_str)
838259
def pub(self, topic, message):
        ''''''
        return self.send(' '.join((constants.PUB, topic)), message)
1231618
private void filterTopics(final Element topicref, final List<FilterUtils> filters) {
        final List<FilterUtils> fs = combineFilterUtils(topicref, filters);

        final String href = topicref.getAttribute(ATTRIBUTE_NAME_HREF);
        final Attr skipFilter = topicref.getAttributeNode(SKIP_FILTER);
        final URI srcAbsUri = job.tempDirURI.resolve(map.resolve(href));
        if (!fs.isEmpty() && skipFilter == null
                && !filtered.contains(srcAbsUri)
                && !href.isEmpty()
                && !ATTR_SCOPE_VALUE_EXTERNAL.equals(topicref.getAttribute(ATTRIBUTE_NAME_SCOPE))
                && !ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY.equals(topicref.getAttribute(ATTRIBUTE_NAME_PROCESSING_ROLE))
                && isDitaFormat(topicref.getAttributeNode(ATTRIBUTE_NAME_FORMAT))) {
            final ProfilingFilter writer = new ProfilingFilter();
            writer.setLogger(logger);
            writer.setJob(job);
            writer.setFilterUtils(fs);
            writer.setCurrentFile(srcAbsUri);
            final List<XMLFilter> pipe = singletonList(writer);

            logger.info("Filtering " + srcAbsUri);
            try {
                xmlUtils.transform(srcAbsUri, pipe);
            } catch (final DITAOTException e) {
                logger.error("Failed to filter " + srcAbsUri + ": " + e.getMessage(), e);
            }
            filtered.add(srcAbsUri);
        }
        if (skipFilter != null) {
            topicref.removeAttributeNode(skipFilter);
        }

        for (final Element child: getChildElements(topicref, MAP_TOPICREF)) {
            if (DITAVAREF_D_DITAVALREF.matches(child)) {
                continue;
            }
            filterTopics(child, fs);
        }
    }
955677
private void populateTopics(String[] topics) {
        for (String t : topics) {
            // Clean up leading and trailing white space as appropriate
            t = t.trim();

            // Ignore topics that start or end with a '/'
            if (t.startsWith("/") || t.endsWith("/") || t.contains("//") || t.isEmpty()) {
                continue;
            }

            // Validate subscribe permission per section 113.10.2
            checkTopicSubscribePermission(t);

            if (t.equals("*")) {
                wildcardTopics.add("");
            } else if (t.endsWith("/*")) {
                wildcardTopics.add(t.substring(0, t.length() - 1));
            } else {
                discreteTopics.add(t);
            }
        }
    }
1197222
def mpub(self, topic, *messages):
        ''''''
        return self.send(constants.MPUB + ' ' + topic, messages)