Skip to content

Instantly share code, notes, and snippets.

@IanWhitney
Last active September 13, 2017 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IanWhitney/15b1fc742a2e6177aedd553743d42f42 to your computer and use it in GitHub Desktop.
Save IanWhitney/15b1fc742a2e6177aedd553743d42f42 to your computer and use it in GitHub Desktop.
  • Head to the confluent directory, prep
    • cd /Users/Ian/Downloads/confluent-3.3.0
    • export PATH=/Users/Ian/Downloads/confluent-3.3.0/bin:$PATH
  • Start up the relevant Confluent stuff
    • clear && ./bin/connect-standalone ./etc/schema-registry/connect-avro-standalone.properties ./etc/kafka-connect-jdbc/source-dors.properties
  • Run your standalone connector
    • clear && ./bin/connect-standalone ./etc/schema-registry/connect-avro-standalone.properties ./etc/kafka-connect-jdbc/source-dors.properties
  • Wait a minute or two for the connector to get up & running
  • You can run a console consumer just to see if there's stuff in the topic
    • --bootstrap-server localhost:9092 --topic test-dors-jdbc-v_reg_total --from-beginning
    • It'll be encoded, so not very readable
  • In a new IRB console of the Dors Spike repo
require 'avro_turf/messaging'
avro = AvroTurf::Messaging.new(registry_url: "http://localhost:8081")
require "kafka"
kafka = Kafka.new(seed_brokers: ["localhost:9092"])
topic = "test-dors-jdbc-v_reg_total" #topic = kafka.topics.last may also work, if you don't have any other topics
kafka.each_message(topic: t) do |m|
d = avro.decode(m.value)
# do stuff with that hash
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment