Skip to main content

Dual-Write

The Go SDK supports "Dual-Write" mode. This allows you to send data to both Conviso and Customer.io simultaneously with a single method call. This is particularly useful during migration periods.

How it Works​

When Identify, Track, or RegisterDevice is called:

  1. The SDK sends the data to the Conviso API.
  2. Also (in sequence) sends the data to Customer.io's API.

The Customer.io call is "best effort" by default—failures there do not block the main Conviso operation unless strictly configured otherwise.

Configuration​

To enable dual-write, provide the CustomerIO configuration struct in CDPConfig.

import "github.com/codematic/opencdp-go/cdp"

config := cdp.CDPConfig{
CDPAPIKey: "your-opencdp-key",

// Enable Dual-Write
SendToCustomerIO: true,

CustomerIO: &cdp.CustomerIOConfig{
SiteID: "your-cio-site-id",
APIKey: "your-cio-api-key",
Region: "us", // Defaults to "us", use "eu" for EU data center
},
}

client := cdp.NewClient(config)

Limitations​

  • Performance: Dual-write involves two network calls, which may increase the latency of your operations slightly.
  • Consistency: While the SDK attempts both, network partitions could theoretically cause data to land in one system but not the other. Monitor your logs for dual-write failures.

Migration Strategy​

  1. Enable Dual-Write in your production environment.
  2. Let it run for a period to populate Conviso with live data.
  3. Backfill historical data (if necessary) using a separate script.
  4. Once verified, disable SendToCustomerIO to stop sending to Customer.io and fully switch to Conviso.