Class: Confluent::Kafka::ServerBase

Inherits:
Object
  • Object
show all
Includes:
MintLogger, MintPress::Mixins::Properties
Defined in:
src/confluent-platform/lib/confluent-platform/model/server_base.rb

Overview

Base class for Server services of Confluent Kafka software. Provides methods for the configuring and managing servers.

Since:

  • 0.1.0

Properties (Read/Write)

  • #name ⇒ String (Default Value: self.class.to_s.gsub('::', ''))

    Property Attributes
    • defaultself.class.to_s.gsub('::', '')
    
    
    57
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 57
    
    property :Name, type: String, default: self.class.to_s.gsub('::', '')
  • #installation ⇒ Confluent::Kafka::Installation
    The Kafka installation associated with this Server

    Property Attributes
    • requiredfalse
    
    
    60
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 60
    
    property :installation, type: Confluent::Kafka::Installation, required: false
  • #host ⇒ MintPress::Infrastructure::Host (Default Value: Proc.new { self.get_property(:installation) ? self.installation.host : nil })
    If the user specifies transport, default to a new host with it, otherwise try java installation ... we'll raise exception if none of this stuff ends up resolving...

    Property Attributes
    • requiredtrue
    • no_backreftrue
    • paralleltrue
    • disposition:requires
    • defaultProc.new { self.get_property(:installation) ? self.installation.host : nil }
    
    
    64
    65
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 64
    
    property :host, type: MintPress::Infrastructure::Host, required: true, no_backref: true, parallel: true,
    disposition: :requires, default: Proc.new { self.get_property(:installation) ? self.installation.host : nil }
  • #java_home ⇒ Pathname (Default Value: Proc.new { self.get_property(:installation) ? self.installation.java_home : nil })
    The JAVA_HOME location to use for this installation

    Property Attributes
    • fromString
    • requiredtrue
    • defaultProc.new { self.get_property(:installation) ? self.installation.java_home : nil }
    
    
    72
    73
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 72
    
    property :java_home, type: Pathname, from: String, required: true,
    default: Proc.new { self.get_property(:installation) ? self.installation.java_home : nil }
  • #kafka_home ⇒ Pathname (Default Value: Proc.new { self.get_property(:installation) ? self.installation.kafka_home : nil })
    The KAFKA_HOME location where this software will be installed

    Property Attributes
    • fromString
    • requiredtrue
    • defaultProc.new { self.get_property(:installation) ? self.installation.kafka_home : nil }
    
    
    76
    77
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 76
    
    property :kafka_home, type: Pathname, from: String, required: true,
    default: Proc.new { self.get_property(:installation) ? self.installation.kafka_home : nil }
  • #properties ⇒ Hash (Default Value: {})
    Additional properties which will be added to the server.properties file as key/value pairs

    Property Attributes
    • default{}
    
    
    80
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 80
    
    property :properties, type: Hash, default: {}
  • #removed_properties ⇒ Hash (Default Value: {})
    list of properties that will be removed from the server.properties file as key/value pairs

    Property Attributes
    • default{}
    
    
    83
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 83
    
    property :removed_properties, type: Hash, default: {}
  • #server_env_opts ⇒ Hash (Default Value: {})
    'Map containing environment variables'

    Property Attributes
    • default{}
    
    
    86
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 86
    
    property :server_env_opts, type: Hash, default: {}, description: 'Map containing  environment variables'
  • #daemon_mode ⇒ [TrueClass, FalseClass] (Default Value: true)
    'Whether server runs in daemon mode'

    Property Attributes
    • defaulttrue
    
    
    88
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 88
    
    property :daemon_mode, type: [TrueClass, FalseClass], default: true, description: 'Whether server runs in daemon mode'
  • #start_timeout_sec ⇒ Integer (Default Value: 300)
    'Start action timeout in seconds'

    Property Attributes
    • default300
    
    
    90
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 90
    
    property :start_timeout_sec, type: Integer, default: 300, description: 'Start action timeout in seconds'
  • #stop_timeout_sec ⇒ Integer (Default Value: 300)
    'Stop action timeout in seconds'

    Property Attributes
    • default300
    
    
    92
    # File 'src/confluent-platform/lib/confluent-platform/model/server_base.rb', line 92
    
    property :stop_timeout_sec, type: Integer, default: 300, description: 'Stop action timeout in seconds'

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary collapse

Attributes included from MintPress::Mixins::Properties

#autopush_set_cache, #dynamic_create, #harvest_on_access, #harvest_undefined_only, #harvested, #tree_root

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MintPress::Mixins::Properties

#[], #[]=, #add_validate_report_result, #armour_set_property, #array_contains?, #array_is_a?, #check_autopush, #check_stack_overflow, #clone_property_object, #cloner_handle_single_property, #coerce_single, #contains_as_string?, #display_validate_report_result, #double_initialize?, #dump_to_hash, #find_parent, #find_parent_by_identity, #generate_accessor_functions, #get_canonical_renamed, #get_from_opts, #get_my_name, #get_property, #get_property_item, #has?, included, #initialize_validate_report, #inspect, #is_cloned_object?, #is_mintpress_object?, #is_probably_canonical?, #is_set?, #local_debug, #local_info, #local_verbose, #mintpress_property_definitions, #place_object_by_identity, #process_properties, #prop_set?, #property, #property_definitions, #property_details, #property_is_simple_object?, #push_root!, #require_property, #require_update, #retrieve_docstring, #sanitize, #set_map_dirty, #set_property, #set_property_item, #show_short_array, #strip_defaults!, #synchronize, #uncloned_property_definitions, #update_map, #validate, #validate_generic, #validate_properties, #validate_property, #validate_required, #version_allowed?, #weakref

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Constructor Details

#initialize(opts = {}) ⇒ Confluent::Kafka::Server

The constructor See https://docs.confluent.io/current/installation/configuration/broker-configs.html for details

Raises:

  • (ArgumentError)
    invalid argument passed into constructor

Since:

  • 0.1.0

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object

Handle function that may retrieve Zookeper properties from 'properties' attribute

Since:

  • 0.1.0

Instance Attribute Details

#installationConfluent::Kafka::Installation

Returns the Confluent Platform installation.

Returns:

Since:

  • 0.1.0

Class Method Details

.compare_properies(map1, map2) ⇒ Object

Determine the difference between two maps This function will be used to see what properties are different between two property maps

Since:

  • 0.1.0

Instance Method Details

#==(other) ⇒ True/False

Compare Objects

Returns:

  • (True/False)
    If two Broker objects are equal

Since:

  • 0.1.0

#check_configurationArray of Arrays

Check current server configuration to determine the difference between configured and actual [ '+', key, value] This means that the property is not on the server and will be added [ '~', key, value1, value2] This means that the property on the server is different to the value1 [ '-', key, value] This means that the property is on the server but not in the object (nothing will be done)

Returns:

  • (Array of Arrays)
    Each array within the response could be in one of the formats:

Since:

  • 0.1.0

#clobber(pre_clobber_proc: nil, post_clobber_proc: nil) ⇒ void

This method returns an undefined value.

Clobber the Server configuration

Since:

  • 0.1.0

#configure_server(pre_configure_proc: nil, post_configure_proc: nil, backup_properties: true) ⇒ void

This method returns an undefined value.

Configure the Server

Since:

  • 0.1.0

#find_process_id(search_keywords) ⇒ String

Determine Kafka Broker process id running on the node

Returns:

  • (String)
    Process ID of the Broker

Since:

  • 0.1.0

#get_connect_host_portString, Integer

Function to return connection host and port details for the server

Returns:

  • (String)
    Hostname of the server
  • (Integer)
    Connection port

Since:

  • 0.1.0

#get_instance_variablesObject

Since:

  • 0.1.0

#harvestvoid

This method returns an undefined value.

Harvest the server configuration from the target

Since:

  • 0.1.0

#harvest_server_props(filename) ⇒ Hash

Harvest server properties

Parameters:

  • filename (String)
    Name of the properties file to load

Returns:

  • (Hash)
    Collection of the name/value pairs

Since:

  • 0.1.0

#killvoid

This method returns an undefined value.

Stop Kafka process by sending kill signal

Since:

  • 0.1.0

#process_exists?Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0

#process_idString

Determine Kafka Broker process id running on the node

Returns:

  • (String)
    Process ID of the Broker

Since:

  • 0.1.0

#running?TrueClass|FalseClass

Determine whether Server instances are running on the node

Returns:

  • (TrueClass|FalseClass)

Since:

  • 0.1.0

#to_hashHash

Return a Hash representation for this class and all its sub-classes.

Returns:

  • (Hash)
    the object in Hash format

Since:

  • 0.1.0

#up_to_date?True/False

Check if remote server is up-to-date with configurations

Returns:

  • (True/False)

Since:

  • 0.1.0

#usageObject

Since:

  • 0.1.0

#waitTrue

Wait for the server to start serving requests on the listening port

Returns:

  • (True)
    on success

Raises:

  • (Error)
    Thrown if server has not responded within allocated time

Since:

  • 0.1.0

#wait_for_ready(timeout_sec = 10, retry_frequency_sec = 5) ⇒ True

Wait for the server to start serving requests on the listening port

Parameters:

  • timeout_sec (Integer) (defaults to: 10)
    Timeout in seconds
  • retry_frequency_sec (Integer) (defaults to: 5)
    Frequency in seconds how often to check the server

Returns:

  • (True)
    on success

Raises:

  • (Error)
    Thrown if server has not responded within allocated time

Since:

  • 0.1.0