Module: Hermann

Defined in:
lib/hermann.rb,
lib/hermann/java.rb,
lib/hermann/errors.rb,
lib/hermann/result.rb,
lib/hermann/timeout.rb,
lib/hermann/version.rb,
lib/hermann/consumer.rb,
lib/hermann/producer.rb,
lib/hermann/discovery/metadata.rb,
lib/hermann/discovery/zookeeper.rb,
lib/hermann/provider/java_producer.rb,
lib/hermann/provider/java_simple_consumer.rb,
ext/hermann/hermann_rdkafka.c

Defined Under Namespace

Modules: ConsumerUtil, Discovery, Errors, JavaApiUtil, JavaUtil, KafkaUtil, ProducerUtil, Provider Classes: Consumer, Producer, Result, Timeout

Constant Summary collapse

VERSION =
'0.27.0'

Class Method Summary collapse

Class Method Details

.jruby?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/hermann.rb', line 2

def self.jruby?
  return RUBY_PLATFORM == "java"
end

.package_properties(options) ⇒ Properties

Packages options into Java Properties object

Returns:

  • (Properties)

    packaged java properties



23
24
25
26
27
28
29
30
# File 'lib/hermann.rb', line 23

def self.package_properties(options)
  properties = JavaUtil::Properties.new
  options.each do |key, val|
    Hermann.validate_property!(key, val)
    properties.put(key, val)
  end
  properties
end

.validate_property!(key, val) ⇒ Object

Validates that the args are non-blank strings

Parameters:

  • key (Object)

    to validate

  • val (Object)

    to validate



12
13
14
15
16
# File 'lib/hermann.rb', line 12

def self.validate_property!(key, val)
  if key.to_s.empty? || val.to_s.empty?
    raise Hermann::Errors::ConfigurationError
  end
end