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

Reconnect opportunity #25

Open
ghost opened this issue Dec 8, 2017 · 7 comments
Open

Reconnect opportunity #25

ghost opened this issue Dec 8, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Dec 8, 2017

Hello guys,

is it possible add functionality to reconnect to queue manager in case with some network partitions or problem with queue manager?

@ghost
Copy link
Author

ghost commented Jan 5, 2018

because some time occure next exception:
[2018-01-05T10:24:52,132][WARN ][logstash.inputs.jms ] JMS Exception has occurred: JMSWMQ1107: A problem with this connection has occurred.
[2018-01-05T10:24:52,132][WARN ][logstash.inputs.jms ] JMS Exception has occurred: JMSWMQ1107: A problem with this connection has occurred.
[2018-01-05T10:24:52,132][WARN ][logstash.inputs.jms ] JMS Exception has occurred: JMSWMQ1107: A problem with this connection has occurred.

@ghost
Copy link
Author

ghost commented Jan 16, 2018

is it possible to add some functionality to try catch some java exception in run method:

import java.net.ConnectException
import com.ibm.msg.client.jms.DetailedIllegalStateException
import com.ibm.mq.MQException
import com.ibm.mq.jmqi.JmqiException

....

 public
  def run(output_queue)
    maxTries=5
    currentTries=1
    while (currentTries <= maxTries)
      begin
        case @runner
          when "consumer" then
            run_consumer(output_queue)
          when "async" then
            run_async(output_queue)
          when "thread" then
            run_thread(output_queue)
        end
      rescue ConnectException, DetailedIllegalStateException, MQException, JmqiException  => connectException
        @logger.warn("current attempt is #{currentTries}")
        @logger.warn("#{connectException}")
        @logger.warn("Message: #{connectException.message}")
        @logger.warn(puts "Backtrace: #{connectException.backtrace}")
      end
    end

  end

@aleskovets
Copy link

It would be quite useful to be able to automatically recover after network incident and not silently die.

@peruzzof
Copy link

peruzzof commented Aug 6, 2018

I am facing the same problem... sometimes I am losing the connectivity with my JMS server (Tibco EMS), I can find the error below on logstash-plain.txt and would be excelent if the logstash could retry connect to it.

[logstash.inputs.jms ] JMS Exception has occurred: Connection has been terminated due to missing server heartbeats

@jonathanmza
Copy link

jonathanmza commented Mar 15, 2019

If you have set a mq connection factory you can do this (the code below comes from one of my java projects) :

mqQueueConnectionFactory.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT);

@NaturesProphet
Copy link

NaturesProphet commented Apr 3, 2019

I have the same problem here. i 'm getting messages from an Apache ActiveMQ server and i'm using those confs:

input 
{
	jms 
	{
		yaml_file => "/usr/share/logstash/activemq/jms.yml"
		yaml_section => "activemq"
		destination => "MyTopic"
		runner => "async"
		pub_sub => true
	}
}

yml:

activemq:
  :factory: org.apache.activemq.ActiveMQConnectionFactory
  :broker_url: failover:(tcp://IP:PORT)?initialReconnectDelay=100&maxReconnectDelay=2000
  :username: usr
  :password: pass
  :require_jars:
    - /usr/share/logstash/activemq/activemq-all-5.15.8.jar

Every time the server goes down, the logstash crashes and i have to manually restart the pipelines.
Hell! theres' no try/catch on this?

@robbavey
Copy link
Contributor

This should have been resolved by #35

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

No branches or pull requests

6 participants