Skip to content

Commit

Permalink
Use rd_kafka_conf_set() instead of rd_kafka_brokers_add()
Browse files Browse the repository at this point in the history
  • Loading branch information
za-arthur committed Jul 12, 2023
1 parent 8c1f273 commit 2232a24
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg: [14, 13, 12, 11, 10, 9.6, 9.5]
pg: [15, 14, 13, 12, 11, 10]
name: PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: zilder/pg-ext-check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg: [14, 13, 12, 11, 10, 9.6]
pg: [15, 14, 13, 12, 11, 10]
name: PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ see `test/init_kafka.sh`

## Usage

CREATE SERVER must specifie a brokerlist using option `brokers`
CREATE SERVER must specify a brokerlist using option `brokers`
```SQL
CREATE SERVER kafka_server
FOREIGN DATA WRAPPER kafka_fdw
Expand Down
13 changes: 4 additions & 9 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ KafkaFdwGetConnection(KafkaOptions *k_options,

conf = rd_kafka_conf_new();

if (rd_kafka_conf_set(conf, "bootstrap.servers", k_options->brokers,
errstr, sizeof(errstr)) != RD_KAFKA_CONF_OK)
elog(ERROR, "%s\n", errstr);

*kafka_handle = rd_kafka_new(RD_KAFKA_CONSUMER, conf, errstr, KAFKA_MAX_ERR_MSG);

if (*kafka_handle != NULL)
{
/* Add brokers */
/* Check if exactly 1 broker was added */
if (rd_kafka_brokers_add(*kafka_handle, k_options->brokers) < 1)
{
rd_kafka_destroy(*kafka_handle);
elog(ERROR, "No valid brokers specified");
*kafka_handle = NULL;
}

/* Create topic handle */
topic_conf = rd_kafka_topic_conf_new();

Expand Down
4 changes: 2 additions & 2 deletions test/run_kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#
set -ex

KAFKA_VERSION=2.8.1
KAFKA_VERSION=2.8.2
KAFKA_ARCHIVE=kafka_2.13-${KAFKA_VERSION}.tgz

DIST=$(cat /etc/os-release | grep ^ID= | sed s/ID=//)

echo

# Download Apache Kafka
wget https://downloads.apache.org/kafka/${KAFKA_VERSION}/${KAFKA_ARCHIVE}
wget https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/${KAFKA_ARCHIVE}
tar -xzf ${KAFKA_ARCHIVE} -C /kafka --strip-components=1
export PATH="/kafka/bin/:$PATH"

Expand Down

0 comments on commit 2232a24

Please sign in to comment.