logstash-plugins / logstash-input-jms

12 stars 27 forks source link

wrong number of arguments calling `each` (given 1, expected 0) with IBM MQ Topic #43

Closed jfluitsma closed 2 years ago

jfluitsma commented 4 years ago

JMS input fails when using a topic with IBM MQ (9.1), subscriber class = Java::ComIbmMqJms::MQTopicSubscriber

JMS Consumer Died {:exception=>"ArgumentError", :exception_message=>"wrong number of arguments calling each (given 1, expected 0)", :backtrace=>["D:/Elk/logstash-7.9.1/vendor/bundle/jruby/2.5.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:235:in run'", "D:/Elk/logstash-7.9.1/logstash-core/lib/logstash/java_pipeline.rb:378:ininputworker'", "D:/Elk/logstash-7.9.1/logstash-core/lib/logstash/java_pipeline.rb:369:in `block in start_input'"]}

Using a queue as input works ok.

kares commented 2 years ago

thanks for the report, sorry it took a year+ to reply - the bug is legit and the cause is the IBM class specifics, namely: com.ibm.mq.jms.MQTopicSubscriber implements multiple interfaces including: java.util.Map and javax.jms.MessageConsumer the later contains the each extension method the plugin assumes to be using from the library.

the order of the implemented interfaces is relevant here, we got: JmsMessageConsumer, JmsPropertyContext, JmsReadablePropertyContext, JmsTopicSubscriber, java.io.Serializable, java.lang.AutoCloseable, java.util.Map<java.lang.String,java.lang.Object>, javax.jms.MessageConsumer, javax.jms.TopicSubscriber

... thus the java.util.Map's each will be the one visible when called -> leading to this issue :crying_cat_face:

:safety_pin: potential work-around would be to copy-paste the library code - not relying on each on the receiver.