Class: Javonet

Inherits:
Object
  • Object
show all
Defined in:
lib/javonet-ruby-sdk/sdk/javonet.rb

Overview

The Javonet class is a singleton class that serves as the entry point for interacting with Javonet. It provides methods to activate and initialize the Javonet SDK. It supports both in-memory and TCP connections.

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/javonet-static-class article on Javonet Guides}

Class Method Summary collapse

Class Method Details

.activate(license_key) ⇒ Integer

Activates Javonet with the provided license key and optionally with proxy data.

Parameters:

  • license_key (String)

    The license key to activate Javonet.

Returns:

  • (Integer)

    The activation status code.

See Also:



51
52
53
54
55
56
57
58
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 51

def self.activate(license_key)
  begin
    return Transmitter.activate(license_key)
  rescue Exception => e
    SdkExceptionHelper.send_exception_to_app_insights(e, license_key)
    raise e
  end
end

.get_runtime_info(get_loaded_modules) ⇒ String

Gets information about the current runtime.

Parameters:

  • get_loaded_modules (Boolean)

    Whether to include loaded modules in the runtime information.

Returns:

  • (String)

    Information about the current runtime.



64
65
66
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 64

def self.get_runtime_info(get_loaded_modules)
  RuntimeLogger.get_runtime_info(get_loaded_modules)
end

.in_memoryRuntimeFactory

Initializes Javonet using an in-memory channel on the same machine.

Returns:

  • (RuntimeFactory)

    A RuntimeFactory instance configured for an in-memory connection.

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/in-memory-channel article on Javonet Guides}


21
22
23
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 21

def self.in_memory
  RuntimeFactory.new(ConnectionType::IN_MEMORY, nil)
end

.set_config_source(config_source) ⇒ Object

Sets the configuration source for the Javonet SDK.

Parameters:

  • config_source (String)

    The configuration source.



70
71
72
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 70

def self.set_config_source(config_source)
  Transmitter.set_config_source(config_source)
end

.tcp(tcp_connection_data) ⇒ RuntimeFactory

Initializes Javonet with a TCP connection to a remote machine.

Parameters:

Returns:

  • (RuntimeFactory)

    A RuntimeFactory instance configured for a TCP connection.

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/tcp-channel article on Javonet Guides}


29
30
31
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 29

def self.tcp(tcp_connection_data)
  RuntimeFactory.new(ConnectionType::TCP, tcp_connection_data)
end

.with_config(path) ⇒ ConfigRuntimeFactory

Initializes Javonet with a custom configuration file.

Parameters:

  • path (String)

    Path to a configuration file.

Returns:

See Also:

  • to this {https://www.javonet.com/guides/v2/ruby/foundations/configure-channel article on Javonet Guides}


37
38
39
40
41
42
43
44
45
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 37

def self.with_config(path)
  begin
    ConfigRuntimeFactory.new(path)
  rescue Exception => e
    SdkExceptionHelper.send_exception_to_app_insights(e, "withConfig")
    raise e
  end

end