// Module included in the following assemblies:
//
// assembly-kafka-bridge-quickstart.adoc

[id='proc-bridge-subscribing-consumer-topics-{context}']
= Subscribing a Kafka Bridge consumer to topics

After you have created a Kafka Bridge consumer, subscribe it to one or more topics by using the link:https://strimzi.io/docs/bridge/latest/#_subscribe[subscription^] endpoint. Once subscribed, the consumer starts receiving all messages that are produced to the topic.

.Procedure

* Subscribe the consumer to the `bridge-quickstart-topic` topic that you created earlier, in xref:proc-producing-messages-from-bridge-topics-partitions-{context}[Producing messages to topics and partitions]:
+
[source,curl,subs=attributes+]
----
curl -X POST http://localhost:8080/consumers/bridge-quickstart-consumer-group/instances/bridge-quickstart-consumer/subscription \
  -H 'content-type: application/vnd.kafka.v2+json' \
  -d '{
    "topics": [
        "bridge-quickstart-topic"
    ]
}'
----
+
The `topics` array can contain a single topic (as shown here) or multiple topics. If you want to subscribe the consumer to multiple topics that match a regular expression, you can use the `topic_pattern` string instead of the `topics` array. 
+
If the request is successful, the Kafka Bridge returns a `204` (No Content) code only.

.What to do next

After subscribing a Kafka Bridge consumer to topics, you can xref:proc-bridge-retrieving-latest-messages-from-consumer-{context}[retrieve messages from the consumer].

.Additional resources

* link:https://strimzi.io/docs/bridge/latest/#_subscribe[POST /consumers/{groupid}/instances/{name}/subscription^] in the API reference documentation.
