Sha256: a1d5143cad88a105dd798b18fae6af9318c8437bd42e77a07737ec525aa2bc1d

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "../lib"))

require "pulsar/client"

unless ARGV.size == 1 && !Pulsar::Client.sufficient_environment?
  puts "Usage: #{__FILE__} <topic>"
  puts
  puts "Additionally, the PULSAR_BROKER_URI environment variable must be set. Optional"
  puts "PULSAR_CERT_PATH and PULSAR_AUTH_TOKEN environment variables are also"
  puts "recognized."
  exit 1
end

topic = ARGV[0]
client = Pulsar::Client.from_environment
producer = client.create_producer(topic)
while data = gets
  data.chomp!
  producer.send(data)
  break if data == "exit"
end
client.close

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pulsar-client-2.4.1.pre.beta.4 bin/example-producer
pulsar-client-2.4.1.pre.beta.2 bin/example-producer
pulsar-client-2.4.1.pre.beta.1 bin/example-producer