def subscribe(self, topic, schema=streamsx.topology.schema.CommonSchema.Python, name=None, connect=None, buffer_capacity=None, buffer_full_policy=None):
schema = streamsx.topology.schema._normalize(schema)<EOL>_name = self.graph._requested_name(name, '<STR_LIT>')<EOL>sl = _SourceLocation(_source_info(), "<STR_LIT>")<EOL>op = self.graph.addOperator(kind="<STR_LIT>", sl=sl, name=_name, stateful=False)<EOL>oport = op.addOutputPort(schema=schema, name=_name)<EOL>params = {'<STR_LIT>': topic, '<STR_LIT>': schema}<EOL>if connect is not None and connect != SubscribeConnection.Direct:<EOL><INDENT>params['<STR_LIT>'] = connect<EOL>if buffer_capacity:<EOL><INDENT>params['<STR_LIT>'] = int(buffer_capacity)<EOL><DEDENT>if buffer_full_policy:<EOL><INDENT>params['<STR_LIT>'] = buffer_full_policy<EOL><DEDENT><DEDENT>op.setParameters(params)<EOL>op._layout_group('<STR_LIT>', name if name else _name)<EOL>return Stream(self, oport)._make_placeable()<EOL>
Subscribe to a topic published by other Streams applications.
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 subscribed as :py:const:`~streamsx.topology.schema.CommonSchema.Python` objects
which connects to streams published to topic by Python Streams applications.

Structured schemas are subscribed to using an instance of
:py:class:`StreamSchema`.  A Streams application publishing
structured schema streams may have been implemented in any
programming language supported by Streams.

JSON streams are subscribed to using schema :py:const:`~streamsx.topology.schema.CommonSchema.Json`.
Each tuple on the returned stream will be a Python dictionary
object created by ``json.loads(tuple)``.
A Streams application publishing JSON streams may have been implemented in any programming language
supported by Streams.

String streams are subscribed to using schema :py:const:`~streamsx.topology.schema.CommonSchema.String`.
Each tuple on the returned stream will be a Python string object.
A Streams application publishing string streams may have been implemented in any programming language
supported by Streams.

Subscribers can ensure they do not slow down matching publishers
by using a buffered connection with a buffer full policy
that drops tuples.

Args:
    topic(str): Topic to subscribe to.
    schema(~streamsx.topology.schema.StreamSchema): schema to subscribe to.
    name(str): Name of the subscribed stream, defaults to a generated name.
    connect(SubscribeConnection): How subscriber will be connected to matching publishers. Defaults to :py:const:`~SubscribeConnection.Direct` connection.
    buffer_capacity(int): Buffer capacity in tuples when `connect` is set to :py:const:`~SubscribeConnection.Buffered`. Defaults to 1000 when `connect` is `Buffered`. Ignored when `connect` is `None` or `Direct`.
    buffer_full_policy(~streamsx.types.CongestionPolicy): Policy when a pulished tuple arrives and the subscriber's buffer is full. Defaults to `Wait` when `connect` is `Buffered`. Ignored when `connect` is `None` or `Direct`.

Returns:
    Stream:  A stream whose tuples have been published to the topic by other Streams applications.

.. versionchanged:: 1.9 `connect`, `buffer_capacity` and `buffer_full_policy` parameters added.

.. seealso:`SubscribeConnection`