Skip to content

support (boolean) type-casting in factory_settings #52

Description

@kares

e.g. when a JMS factory setter accepts a boolean (int, long should work but could use a test) value the plugin will fail to start:

input {
    jms {
        broker_url => '(tcp://activemq:61616)/?initialReconnectDelay=100' 
        destination => 'myqueue' 
        factory => 'org.apache.activemq.ActiveMQConnectionFactory' 
        username => 'admin'
        password => 'password'

        # Message selector
        selector => "string_property = 'this' OR int_property < 3" 
        
        # Connection factory specific settings
        factory_settings => { 
                              exclusive_consumer => true
        }

        require_jars => ['./apache-activemq-5.16.0/activemq-all-5.16.0.jar'] 
    }
  }

this will attempt to do a factory.setExclusiveConsumer but will fail due the parameter being "true" instead of true.

[2020-10-27T09:34:41,458][WARN ][logstash.inputs.jms      ][main]
JMS Consumer Died {:exception=>"TypeError", :exception_message=>"cannot convert instance of class org.jruby.RubyString to boolean", :backtrace=>[
"/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:193:in `block in initialize'", 
"org/jruby/RubyHash.java:1415:in `each'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:188:in `initialize'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:225:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:405:in `inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:396:in `block in start_input'"]} ...

... relevant jruby-jms line simply does a send, this should be considered when migrating from using the gem #50


The issue originates from a LS bug report: elastic/logstash#12343

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions