Sha256: 9e7155d12003f380d75f8a557c5b07c487e71315f2d9b07339a6962d8df4bb66

Contents?: true

Size: 674 Bytes

Versions: 11

Compression:

Stored size: 674 Bytes

Contents

module Kafka
  module Protocol

    # SaslHandshake Request (Version: 0) => mechanism
    #  mechanism => string

    class SaslHandshakeRequest

      SUPPORTED_MECHANISMS = %w(GSSAPI PLAIN)

      def initialize(mechanism)
        unless SUPPORTED_MECHANISMS.include?(mechanism)
          raise Kafka::Error, "Unsupported SASL mechanism #{mechanism}. Supported are #{SUPPORTED_MECHANISMS.join(', ')}"
        end
        @mechanism = mechanism
      end

      def api_key
        SASL_HANDSHAKE_API
      end

      def response_class
        SaslHandshakeResponse
      end

      def encode(encoder)
        encoder.write_string(@mechanism)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby-kafka-0.4.4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0.beta6 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0.beta5 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0.beta4 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0.beta3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.5.0.beta2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.4.3 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.4.2 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.4.1 lib/kafka/protocol/sasl_handshake_request.rb
ruby-kafka-0.4.0 lib/kafka/protocol/sasl_handshake_request.rb