Class: SSLLoggerExample

### Home Classes Methods

### In Files

- examples/logexamp_ssl.rb

### Parent

Object

### Methods

- ::new
- #run

### Files

- CHANGELOG.rdoc
- LICENSE

### Class/Module Index

Quicksearch

- Stomp
- Stomp::Client
- Stomp::Connection
- Stomp::Error
- Stomp::Error::BrokerException
- Stomp::Error::ConnectReadTimeout
- Stomp::Error::DuplicateSubscription
- Stomp::Error::InvalidFormat
- Stomp::Error::InvalidHeartBeatHeaderError
- Stomp::Error::InvalidMessageLength
- Stomp::Error::InvalidServerCommand
- Stomp::Error::LoggerConnectionError
- Stomp::Error::MalformedFailoverOptionsError
- Stomp::Error::MaxReconnectAttempts
- Stomp::Error::MessageIDRequiredError
- Stomp::Error::NilMessageError
- Stomp::Error::NoCurrentConnection
- Stomp::Error::PacketParsingTimeout
- Stomp::Error::ProducerFlowControlException
- Stomp::Error::ProtocolError11p
- Stomp::Error::ProtocolErrorConnect
- Stomp::Error::ProtocolErrorEmptyHeaderKey
- Stomp::Error::ProtocolErrorEmptyHeaderValue
- Stomp::Error::ProtocolException
- Stomp::Error::ReadReceiptTimeoutException
- Stomp::Error::SSLClientParamsError
- Stomp::Error::SSLNoCertFileError
- Stomp::Error::SSLNoKeyFileError
- Stomp::Error::SSLNoTruststoreFileError
- Stomp::Error::SSLUnreadableCertFileError
- Stomp::Error::SSLUnreadableKeyFileError
- Stomp::Error::SSLUnreadableTruststoreFileError
- Stomp::Error::SocketOpenTimeout
- Stomp::Error::StartTimeoutException
- Stomp::Error::StompException
- Stomp::Error::StompServerError
- Stomp::Error::SubscriptionRequiredError
- Stomp::Error::UTF8ValidationError
- Stomp::Error::UnsupportedProtocolError
- Stomp::HeaderCodec
- Stomp::Message
- Stomp::NullLogger
- Stomp::SSLParams
- Client11Example1
- Client11PutGet1
- Connection11Example1
- Connection11Example2
- ExampleConsumer
- ExamplePublisher
- ExampleRubyCiphers
- ExampleSSL1
- ExampleSSL1C
- ExampleSSL2
- ExampleSSL2C
- ExampleSSL3
- ExampleSSL3C
- ExampleSSL4
- ExampleSSL4C
- ExampleSSLCtxOptions
- ExampleSSLNewParm
- ExampleTopicConsumer
- ExampleTopicPublisher
- Hash
- HeartBeatExample1
- LoggerExample
- Object
- Publish11Example1
- Receive11Example1
- Receive11Example2
- RepeatedHeadersExample
- SSLLoggerExample
- Slogger
- Stomp11Common
- TestAnonymous
- TestBase
- TestClient
- TestConnection
- TestConnection1P
- TestMessage
- TestSSL
- TestURLLogins
- Tlogger

No matching classes.

# SSLLoggerExample

## A STOMP::Connection program which uses the callback logging facility.

### Public Class Methods

new() click to toggle source

Initialize.

    # File examples/logexamp_ssl.rb, line 17
    def initialize
    end

### Public Instance Methods

run() click to toggle source

Run example.

    # File examples/logexamp_ssl.rb, line 20
    def run
      llog =        Logger::new(STDOUT)
      llog.level =  Logger::DEBUG
      llog.debug "LESSL Starting"

      # //////////////////////////////////////////////////////////////////////////////
      mylog = Slogger::new  # The client provided STOMP callback logger

      # //////////////////////////////////////////////////////////////////////////////
      user =      ENV['STOMP_USER'] ? ENV['STOMP_USER'] : 'guest'
      password =  ENV['STOMP_PASSWORD'] ? ENV['STOMP_PASSWORD'] : 'guest'
      host =      ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : 'localhost'
      port =      ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
      # //////////////////////////////////////////////////////////////////////////////
      # A hash type connect *MUST* be used to enable callback logging.
      # //////////////////////////////////////////////////////////////////////////////
      hash = { :hosts => [
          {:login => user, :passcode => password, :host => host, :port => port,
          :ssl => true}, # Or provide your insance of SSLParams instead
        ],
        :logger => mylog, # This enables callback logging!
        :max_reconnect_attempts => 2,
      }

      # //////////////////////////////////////////////////////////////////////////////
      # For a Connection:
      llog.debug "LESSL Connection processing starts"
      conn = Stomp::Connection.new(hash)
      conn.disconnect
      # //////////////////////////////////////////////////////////////////////////////
      llog.debug "LESSL Connection processing complete"

      # //////////////////////////////////////////////////////////////////////////////
      # For a Client:
      llog.debug "LESSL Client processing starts"
      conn = Stomp::Client.new(hash)
      conn.close
      # //////////////////////////////////////////////////////////////////////////////
      llog.debug "LESSL Client processing complete"

      # //////////////////////////////////////////////////////////////////////////////
      # For a Connection with other calls:
      llog.debug "LESSL Connection Enhanced processing starts"
      conn = Stomp::Connection.new(hash)
      #
      dest = "/queue/loggerq1"
      conn.publish dest, "a logger message"
      conn.subscribe dest
      msg = conn.receive
      conn.disconnect
      # //////////////////////////////////////////////////////////////////////////////
      llog.debug "LESSL Connection Enhanced processing complete"

      # //////////////////////////////////////////////////////////////////////////////
      llog.debug "LESSL Ending"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.