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, proxy_host = nil, proxy_user_name = nil, proxy_password = nil) ⇒ Integer

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

Parameters:

  • license_key (String)

    The license key to activate Javonet.

  • proxy_host (String) (defaults to: nil)

    The host for the proxy server (optional).

  • proxy_user_name (String) (defaults to: nil)

    The username for the proxy server (optional).

  • proxy_user_password (String)

    The password for the proxy server (optional).

Returns:

  • (Integer)

    The activation status code.

See Also:



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 58

def self.activate(license_key, proxy_host=nil, proxy_user_name=nil, proxy_password=nil)
  proxy_host ||= ""
  proxy_user_name ||= ""
  proxy_password ||= ""
  begin
    return Transmitter.activate_with_credentials_and_proxy(license_key, proxy_host, proxy_user_name, proxy_password)
  rescue Exception => e
    SdkExceptionHelper.send_exception_to_app_insights(e, license_key)
    raise e
  end
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}


24
25
26
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 24

def self.in_memory
  RuntimeFactory.new(ConnectionType::IN_MEMORY, nil)
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}


32
33
34
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 32

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}


40
41
42
43
44
45
46
47
48
49
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 40

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

end