Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support (boolean) type-casting in factory_settings #52

Open
kares opened this issue Jan 12, 2022 · 0 comments
Open

support (boolean) type-casting in factory_settings #52

kares opened this issue Jan 12, 2022 · 0 comments
Labels

Comments

@kares
Copy link
Contributor

kares commented Jan 12, 2022

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

@kares kares added the bug label Jan 12, 2022
@kares kares changed the title support type-casting in factory_settings support (boolean) type-casting in factory_settings Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant