# KubeMQCqrsOptions (/integrations/nestjs/reference/cqrs-options)



Every field accepted by `KubeMQCqrsModule.forRoot()` when wiring up the [CQRS bridge](../how-to/cqrs-bridge).

## Configuration Options [#configuration-options]

`KubeMQCqrsModule.forRoot()` accepts `KubeMQCqrsOptions`. All fields are optional and have sensible defaults.

| Parameter              | Type                          | Default                    | Description                                                                                                    |
| ---------------------- | ----------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `commandChannelPrefix` | `string`                      | `'cqrs.commands'`          | Channel prefix for commands; the full channel is `{prefix}.{CommandName}`.                                     |
| `queryChannelPrefix`   | `string`                      | `'cqrs.queries'`           | Channel prefix for queries.                                                                                    |
| `eventChannelPrefix`   | `string`                      | `'cqrs.events'`            | Channel prefix for events.                                                                                     |
| `persistEvents`        | `boolean`                     | `false`                    | Publish events to the durable Events Store (`sendEventStore`) instead of fire-and-forget Events (`sendEvent`). |
| `commandTimeout`       | `number`                      | `10`                       | Command request-reply timeout (seconds).                                                                       |
| `queryTimeout`         | `number`                      | `10`                       | Query request-reply timeout (seconds).                                                                         |
| `drainTimeoutSeconds`  | `number`                      | `5`                        | Time to drain in-flight messages when the module is destroyed (seconds).                                       |
| `channelResolver`      | `(message: object) => string` | `message.constructor.name` | Maps a message instance to its channel segment (the part after the prefix).                                    |
| `serializer`           | `KubeMQSerializer`            | `JsonSerializer`           | Outbound message serializer.                                                                                   |
| `deserializer`         | `KubeMQDeserializer`          | `JsonDeserializer`         | Inbound response deserializer.                                                                                 |

For async configuration (for example, pulling prefixes from `ConfigService`), use `KubeMQCqrsModule.forRootAsync({ imports, useFactory, inject })`, which returns the same providers via a factory.

## Related [#related]

<Cards>
  <Card title="Set up the CQRS bridge" href="../how-to/cqrs-bridge" description="Install, configure, and dispatch commands, queries, and events through KubeMQ." />

  <Card title="CQRS Bridge Concepts" href="../concepts/cqrs-bridge" description="How the bridge routes CommandBus, QueryBus, and EventBus traffic over KubeMQ." />
</Cards>
