From users-return-51388-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Tue May 14 17:36:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6BED918065D for ; Tue, 14 May 2019 19:36:04 +0200 (CEST) Received: (qmail 85149 invoked by uid 500); 14 May 2019 17:36:02 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 85138 invoked by uid 99); 14 May 2019 17:36:02 -0000 Received: from Unknown (HELO mailrelay1-lw-us.apache.org) (10.10.3.159) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2019 17:36:02 +0000 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by mailrelay1-lw-us.apache.org (ASF Mail Server at mailrelay1-lw-us.apache.org) with ESMTPSA id 494DD1BFB for ; Tue, 14 May 2019 17:36:02 +0000 (UTC) Received: by mail-oi1-f179.google.com with SMTP id t187so9449151oie.10 for ; Tue, 14 May 2019 10:36:02 -0700 (PDT) X-Gm-Message-State: APjAAAVFmp4WNOolG0btlETguhitukLJt70l5n+3ObztSZo2OiYMtbKc yd/zHfAVQtClSA8VT+w+dOV9/nfLIMClKT+JYqYZSQ== X-Google-Smtp-Source: APXvYqy0vkAf+oFzrtJdydizFCU7BX1odFMEuvD1wEdkm7t8RTaxezri/cYzR1RXoDG+IF2p7eiqwra6K5D928g25Vs= X-Received: by 2002:aca:b942:: with SMTP id j63mr3639245oif.160.1557855361821; Tue, 14 May 2019 10:36:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Justin Bertram Date: Tue, 14 May 2019 12:35:35 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Artemis Client Wait for Connection Time To: users@activemq.apache.org Content-Type: multipart/alternative; boundary="000000000000741d6b0588dc774a" --000000000000741d6b0588dc774a Content-Type: text/plain; charset="UTF-8" > But can I configure a timeout for this instead of number of connections? No. The recommended option would be to use initial-connect-attempts and reconnect-attempts and needed. If you need functionality beyond that then I'd recommend writing a utility class yourself to catch the exceptions and retry as necessary. Justin On Tue, May 14, 2019 at 5:52 AM Felipe Fraga wrote: > Hello all, > > I have a standalone Artemis 2.6.4 running and I am connecting to it using > JMS from the client of an embedded Artemis on Wildfly 13, so Artemis client > 1.5.5. > > My client code looks like this: > > @Inject > @JMSConnectionFactory(JMSConnectionFactoryName.DEFAULT) > private JMSContext jmsContext; > > jmsContext.createProducer().send(queue, myMessage); > > Now, sometimes the application inside Wildfly receives requests before the > Artemis server is up, effectively throwing a: > > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED > message=AMQ119007: Cannot connect to server(s). Tried with all available > servers.] > > I am trying to have the client lock and wait for a connection before > throwing the error. > > At the Artemis Connection Factory configuration I have setup this > parameter: > > > And I recognise that the higher the number of initial-connect-attemps > (default value is 1) the longer the client hangs and wait for the > connection. But can I configure a timeout for this instead of number of > connections? I haven't been able to identify that in the docs. I guess > maybe I could use -1 (infinite), but I possibly want to get the exception > if for some reason the Artemis server is not going live. > > Also, I would like this to happen on reconnection attemps, but the > reconnect-attempts already has -1 as default value, so I guess its fine. > > So essentially I would like clients to hang and wait some time for the live > server to start OR come back before throwing the > ActiveMQNotConnectedException. What is the recommended connection factory > configuration to achieve this? > > Thanks a lot for your time, > > Felipe > --000000000000741d6b0588dc774a--