streamnative / pulsarctl

a CLI for Apache Pulsar written in Go
Apache License 2.0
158 stars 68 forks source link

How to set `--sink-config` when create a sink connector #1157

Open shibd opened 1 year ago

shibd commented 1 year ago

I'm trying use this cmd:

pulsarctl sinks create 
--archive builtin://aws-eventbridge --tenant public \
--namespace default --inputs eventbridge-test-2 \
--name eventbridge-pulsarctl-test \
--sink-config "{"accessKeyId":"test","secretAccessKey":"test","region":"ap-northeast-1","eventBusName":"baodi-test","eventBusResourceName":"arn:aws:events:ap-northeast-1:598203581484:event-bus/baodi-test"}"

But the actual configuration does not:

2023-08-01T10:15:18,276+0000 [public/default/eventbridge-pulsarctl-test-aa7ec250-0] INFO  org.apache.pulsar.functions.instance.JavaInstanceRunnable - Starting Java Instance eventbridge-pulsarctl-test-aa7ec250 :
 Details = tenant: "public"
namespace: "default"
name: "eventbridge-pulsarctl-test-aa7ec250"
className: "org.apache.pulsar.functions.api.utils.IdentityFunction"
parallelism: 1
source {
  typeClassName: "org.apache.pulsar.client.api.schema.GenericObject"
  inputSpecs {
    key: "eventbridge-test-2"
    value {
    }
  }
}
sink {
  className: "org.apache.pulsar.io.eventbridge.sink.EventBridgeSink"
  configs: "{}"
  typeClassName: "org.apache.pulsar.client.api.schema.GenericObject"
}
resources {
  cpu: 1.0
  ram: 1073741824
}
componentType: SINK
shibd commented 1 year ago

@jiangpengcheng Please help take a look at it. Thanks

jiangpengcheng commented 1 year ago

@shibd should use ' instead of " for the argument: '{"accessKeyId":"test","secretAccessKey":"test","region":"ap-northeast-1","eventBusName":"baodi-test","eventBusResourceName":"arn:aws:events:ap-northeast-1:598203581484:event-bus/baodi-test"}'

shibd commented 1 year ago

I see, it seems like we need to modify examples.

    #Create a Pulsar Sink in cluster mode with sink config
    pulsarctl sink create
    --sink-config "{"publishTopic":"publishTopic", "key":"pulsar"}"
    // Other sink parameters