<?php

/**
 * Example: publish a message to a topic.
 *
 * Run: php produce.php
 */

require_once __DIR__ . '/../autoload.php';

$config   = new KafkaConfig('127.0.0.1:9092');
$producer = new Producer($config);

$producer->produce(
    'orders',
    ['order_id' => 1001, 'amount' => 49.99, 'email' => 'user@example.com'],
    key: 'order-1001',
    headers: ['source' => 'checkout']
);

echo "Message published to 'orders'.\n";
