Odoo Kafka integration

Kafka Connector

Send Odoo changes to Kafka topics, and turn Kafka messages into Odoo records.

Apache Kafka and Odoo 19

What it does

Pick a model, the fields and the events. Odoo writes each change to an outbox in the same transaction and a scheduled job produces it to your topic through the Kafka REST Proxy. In the other direction, a consumer reads topics into a log or creates and updates records from signed messages.

The module talks to Kafka through the REST Proxy API, so nothing has to be installed on the Odoo server: no Kafka client library, no extra worker. Producing uses the v3 records endpoint, which works on a self-hosted REST Proxy, on Confluent Server and on Confluent Cloud. Consuming uses the v2 consumer instances of a self-hosted REST Proxy.

An event stream is one model, the fields you tick and a filter. On create, update or delete the change is written to the Kafka outbox inside the same database transaction. If the change is rolled back, the event is gone too. A job every two minutes sends the queue in order: key model/id, value JSON with the event, the record id, the company and your fields. Each record is read again with the rights of the user you choose, so record rules still apply.

Kafka answers HTTP 200 even when one record fails, so the module checks the error code of every delivery report. Failures wait 1, 2, 4, 8 minutes before the next try, and after the number of tries you set the event is marked Gave Up and a note is posted on the connection.

A consumer subscribes to topics, reads them on a schedule or when you press Read Now, and commits the offsets after Odoo has stored the messages. Keep them in the message log, or map message keys to fields of one model and let Odoo create or update records. That second mode only accepts messages signed with your secret, and it writes with the rights of the user you pick.

Who it is for

  • Engineering teams that run an event-driven platform on Kafka. Other services want to know when a customer, product or order changes in Odoo, without polling Odoo's API. An event stream sends create, update and delete events for one model to a Kafka topic, with only the fields you choose and an optional filter.
  • Companies that cannot afford lost or half-sent events. Each event is written to an outbox in the same database transaction as the change, so a rolled-back edit sends nothing. A scheduled job sends queued events every 2 minutes and retries with a growing wait before giving up and posting a notice in the chatter.
  • Data teams feeding a warehouse or search index. Queue All Matching Records sends a snapshot event for every existing record, which is handy for the first load of a downstream system. Each message carries the event, model, record ID, source name, company and a UTC timestamp.
  • Integrators pushing data from Kafka into Odoo. A consumer subscribes to topics and either keeps messages in a log or creates and updates records of one model from a field mapping. Writing records only accepts messages with a valid HMAC-SHA256 signature and runs as the user you choose.

Setting it up

  1. Make sure a Confluent REST Proxy, Confluent Server or Confluent Cloud cluster REST endpoint is reachable from Odoo, and get its API key and secret or a bearer token.
  2. In Odoo go to Kafka > Configuration > Connections, enter the REST Proxy URL, set API v3 Path (/v3 for a standalone REST Proxy, /kafka/v3 for Confluent Server and Cloud), the authentication and the Cluster ID, and press Test Connection.
  3. Press Read Topics to list the cluster's topics, and set a Signing Secret if messages should carry an HMAC-SHA256 signature.
  4. Under Kafka > Event Streams, create a stream with the topic, Odoo model, Fields Sent, an optional domain and which of On Create, On Update and On Delete apply. Press Preview Message to check the JSON.
  5. To read from Kafka, create a consumer under Kafka > Consumers with the consumer group, topics and offset reset, choose log only or create and update records, then press Subscribe.
  6. Watch Kafka > Outbox and Kafka > Received Messages, and use Retry on anything that failed.

Kafka Connector: questions

Do I need to install a Kafka client library on the Odoo server?

No. All traffic goes over HTTP to the Confluent REST Proxy API, so only the Python requests library is used. You do need a REST Proxy or Confluent Cloud's REST endpoint in front of your brokers.

Does it work with Confluent Cloud?

For producing, yes, through the cluster REST endpoint. Consumers use the REST Proxy v2 consumer API, which Confluent Cloud does not offer, so reading topics needs a self-hosted REST Proxy or Confluent Server.

Can sensitive data leak into Kafka?

Technical models such as users, groups, payment providers and ir.* are blocked, as are binary fields and fields whose names look like passwords, tokens or IBANs. Fields restricted to user groups cannot be selected either.

What happens when Kafka is down?

Events wait in the outbox and are retried up to Retries Before Giving Up, 6 by default. After that they are marked as given up and can be sent again with Retry.

Can a consumer write into any model?

Only one target model per consumer, and only from signed messages, using a match key to find existing records and an option to create missing ones. The same blocked-model list applies on the way in.

Is it limited to one company?

Each connection, with its streams and consumers, belongs to one company, and record rules keep users to the companies they can access. It depends only on base and Discuss mail, so it runs on Odoo 19 Community.