Skip to content

Commit

Permalink
updated sample usage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebrilhante committed Jun 29, 2024
1 parent 2994ae7 commit 549999e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PULSAR_ADDRESS=pulsar://localhost:6650
PULSAR_TOPIC_NAME=test
PULSAR_TOPIC=persistent://public/default/test
TCP_SOCKET=127.0.0.1:9999
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ CREATE TABLE pulsar_cassandra_sink (key text PRIMARY KEY, col text);
```bash
pulsar-daemon start standalone
pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema
pulsar-admin sinks create \
--tenant public \
--namespace default \
--name cassandra-sink \
--archive $PWD/pulsar/connectors/cassandra/pulsar-io-cassandra-3.2.2.nar \
--inputs $PULSAR_TOPIC_NAME \
--name cassandra-sink \
--sink-config-file $PWD/pulsar/connectors/cassandra/cassandra-sink.yml \
--inputs test
--parallelism 1
```

#### PostgreSQL
Expand All @@ -68,11 +67,11 @@ CREATE TABLE IF NOT EXISTS pulsar_postgres_jdbc_sink (
```bash
pulsar-daemon start standalone
pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema
pulsar-admin sinks create \
--archive $PWD/pulsar/connectors/postgres/pulsar-io-jdbc-postgres-3.2.2.nar \
--inputs test \
--inputs $PULSAR_TOPIC_NAME \
--name postgres-sink \
--sink-config-file $PWD/pulsar/connectors/postgres/postgres-sink.yaml \
--parallelism 1
Expand All @@ -92,11 +91,11 @@ CREATE TABLE IF NOT EXISTS pulsar_questdb_sink (
```bash
pulsar-daemon start standalone
pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema
pulsar-admin sinks create \
--archive $PWD/pulsar/connectors/postgres/pulsar-io-jdbc-postgres-3.2.2.nar \
--inputs test \
--inputs $PULSAR_TOPIC_NAME \
--name questdb-sink \
--sink-config-file $PWD/pulsar/connectors/questdb/questdb-sink.yaml \
--parallelism 1
Expand Down
Binary file removed pulsar/data/zookeeper/version-2/log.1
Binary file not shown.
Binary file removed pulsar/data/zookeeper/version-2/snapshot.0
Binary file not shown.
9 changes: 4 additions & 5 deletions scripts/run_cassandra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

pulsar-daemon start standalone

pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema

pulsar-admin sinks create \
--tenant public \
--namespace default \
--name cassandra-sink \
--archive $PWD/pulsar/connectors/cassandra/pulsar-io-cassandra-3.2.2.nar \
--inputs $PULSAR_TOPIC_NAME \
--name cassandra-sink \
--sink-config-file $PWD/pulsar/connectors/cassandra/cassandra-sink.yml \
--inputs test
--parallelism 1
4 changes: 2 additions & 2 deletions scripts/run_postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pulsar-daemon start standalone

pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema

pulsar-admin sinks create \
--archive $PWD/pulsar/connectors/postgres/pulsar-io-jdbc-postgres-3.2.2.nar \
--inputs test \
--inputs $PULSAR_TOPIC_NAME \
--name postgres-sink \
--sink-config-file $PWD/pulsar/connectors/postgres/postgres-sink.yaml \
--parallelism 1
4 changes: 2 additions & 2 deletions scripts/run_questdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pulsar-daemon start standalone

pulsar-admin schemas upload test -f ./connectors/avro-schema
pulsar-admin schemas upload test -f $PWD/pulsar/connectors/avro-schema

pulsar-admin sinks create \
--archive $PWD/pulsar/connectors/postgres/pulsar-io-jdbc-postgres-3.2.2.nar \
--inputs test \
--inputs $PULSAR_TOPIC_NAME \
--name questdb-sink \
--sink-config-file $PWD/pulsar/connectors/questdb/questdb-sink.yaml \
--parallelism 1
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async fn send_messages(
mut rx: mpsc::Receiver<String>,
) {
while let Some(message) = rx.recv().await {
if let Err(e) = producer.send(message).await {
if let Err(e) = producer.send_non_blocking(message).await {
eprintln!("Failed to send message to Pulsar; err = {:?}...", e);
}
}
Expand Down

0 comments on commit 549999e

Please sign in to comment.