def publish(self, topic, schema=None, name=None):
        """
        Publish this stream on a topic for other Streams applications to subscribe to.
        A Streams application may publish a stream to allow other
        Streams applications to subscribe to it. A subscriber
        matches a publisher if the topic and schema match.

        By default a stream is published using its schema.

        A stream of :py:const:`Python objects <streamsx.topology.schema.CommonSchema.Python>` can be subscribed to by other Streams Python applications.

        If a stream is published setting `schema` to
        :py:const:`~streamsx.topology.schema.CommonSchema.Json`
        then it is published as a stream of JSON objects.
        Other Streams applications may subscribe to it regardless
        of their implementation language.

        If a stream is published setting `schema` to
        :py:const:`~streamsx.topology.schema.CommonSchema.String`
        then it is published as strings
        Other Streams applications may subscribe to it regardless
        of their implementation language.

        Supported values of `schema` are only
        :py:const:`~streamsx.topology.schema.CommonSchema.Json`
        and
        :py:const:`~streamsx.topology.schema.CommonSchema.String`.

        Args:
            topic(str): Topic to publish this stream to.
            schema: Schema to publish. Defaults to the schema of this stream.
            name(str): Name of the publish operator, defaults to a generated name.
        Returns:
            streamsx.topology.topology.Sink: Stream termination.

        .. versionadded:: 1.6.1 `name` parameter.

        .. versionchanged:: 1.7
            Now returns a :py:class:`Sink` instance.
        """
        sl = _SourceLocation(_source_info(), 'publish')
        schema = streamsx.topology.schema._normalize(schema)
        if schema is not None and self.oport.schema.schema() != schema.schema():
            nc = None
            if schema == streamsx.topology.schema.CommonSchema.Json:
                schema_change = self.as_json()
            elif schema == streamsx.topology.schema.CommonSchema.String:
                schema_change = self.as_string()
            else:
                raise ValueError(schema)
               
            if self._placeable:
                self._colocate(schema_change, 'publish')
            sp = schema_change.publish(topic, schema=schema, name=name)
            sp._op().sl = sl
            return sp

        _name = self.topology.graph._requested_name(name, action="publish")
        # publish is never stateful
        op = self.topology.graph.addOperator("com.ibm.streamsx.topology.topic::Publish", params={'topic': topic}, sl=sl, name=_name, stateful=False)
        op.addInputPort(outputPort=self.oport)
        op._layout_group('Publish', name if name else _name)
        sink = Sink(op)

        if self._placeable:
            self._colocate(sink, 'publish')
        return sink
Publish this stream on a topic for other Streams applications to subscribe to.
        A Streams application may publish a stream to allow other
        Streams applications to subscribe to it. A subscriber
        matches a publisher if the topic and schema match.

        By default a stream is published using its schema.

        A stream of :py:const:`Python objects <streamsx.topology.schema.CommonSchema.Python>` can be subscribed to by other Streams Python applications.

        If a stream is published setting `schema` to
        :py:const:`~streamsx.topology.schema.CommonSchema.Json`
        then it is published as a stream of JSON objects.
        Other Streams applications may subscribe to it regardless
        of their implementation language.

        If a stream is published setting `schema` to
        :py:const:`~streamsx.topology.schema.CommonSchema.String`
        then it is published as strings
        Other Streams applications may subscribe to it regardless
        of their implementation language.

        Supported values of `schema` are only
        :py:const:`~streamsx.topology.schema.CommonSchema.Json`
        and
        :py:const:`~streamsx.topology.schema.CommonSchema.String`.

        Args:
            topic(str): Topic to publish this stream to.
            schema: Schema to publish. Defaults to the schema of this stream.
            name(str): Name of the publish operator, defaults to a generated name.
        Returns:
            streamsx.topology.topology.Sink: Stream termination.

        .. versionadded:: 1.6.1 `name` parameter.

        .. versionchanged:: 1.7
            Now returns a :py:class:`Sink` instance.