Skip to content

Instantly share code, notes, and snippets.

require 'kafka'
kafka = Kafka.new(
seed_brokers: ["0.0.0.0:9092"],
client_id: "miq-persistor"
)
consumer = kafka.consumer(group_id: "miq-persisters")
consumer.subscribe("inventory")
consumer.each_message do |message|
require 'kafka'
$producer = Kafka.new(seed_brokers: ['localhost:9092']).producer
def send_or_update(ems, persister, count, batch_size)
if count == :rest || count > batch_size
inventory_yaml = persister.to_yaml
puts "sending inventory to kafka, #{inventory_yaml.size} bytes"
$producer.produce(inventory_yaml, topic: 'inventory')
@atyronesmith
atyronesmith / cr-nsd.yaml
Last active June 2, 2016 07:59
NSD and related translated VNFDs for demo, the cf-vnfd-xlate-N.yaml files are what the translated files should look like. The cr-vnfd.yaml file is the base untranslated file.
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OPNFV demo NSD
metadata:
ID: OPNFV demo # ID of this Network Service Descriptor
vendor: Red Hat Inc. # Provider or vendor of the Network Service
version: 1 # Version of the Network Service Descriptor
topology_template: