> ## Documentation Index
> Fetch the complete documentation index at: https://cosmo-docs.wundergraph.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kafka

## Definitions

<Note>
  The `providerId` argument, including the default value "default", *must* correspond to an equivalent property in *events.providers.kafka* entry of the router config.yml.
</Note>

<Note>
  Kafka topic arguments support argument templates such as `employeeUpdated.{{ args.employeeID }}`. If you use templates, create the rendered Kafka topics in your broker ahead of time because the Router does not create topics automatically.
</Note>

### @edfs\_kafkaPublish

```js theme={"system"}
directive @edfs__kafkaPublish(
  topic: String!,
  providerId: String! = "default"
) on FIELD_DEFINITION

type edfs__PublishResult {
    success: Boolean!
}
```

| Argument name | Type    | Value                                                                                                                                    |
| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| topic         | String! | The event topic. Argument templates are supported.                                                                                       |
| providerId    | String! | The provider ID, which identifies the connection in the router config.yaml. <br />If unsupplied, the provider ID "default" will be used. |

### @edfs\_\_kafkaSubscribe

```js theme={"system"}
directive @edfs__kafkaSubscribe(
  topics: [String!]!,
  providerId: String! = "default"
) on FIELD_DEFINITION
```

| Argument name | Type        | Value                                                                                                                                    |
| ------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| topics        | \[String!]! | The event topics (it is possible to subscribe to multiple topics). Argument templates are supported.                                     |
| providerId    | String!     | The provider ID, which identifies the connection in the router config.yaml. <br />If unsupplied, the provider ID "default" will be used. |

<CardGroup>
  <Card title="Kafka" href="/router/event-driven-federated-subscriptions-edfs/kafka" icon="sitemap" horizontal />
</CardGroup>
