> 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 <felipefr...@gmail.com> 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: > > <pooled-connection-factory initial-connect-attempts="10" > > 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 >