quarkiverse / quarkus-ironjacamar

IronJacamar is an implementation of the Jakarta Connector Architecture specification
https://docs.quarkiverse.io/quarkus-ironjacamar/dev/index.html
Apache License 2.0
4 stars 2 forks source link

unable to prefill connection pool and `ironjacamar_pool_active_count_total` does not reflect consumer #45

Closed vsevel closed 1 year ago

vsevel commented 1 year ago

I have tried to prefill the pool to start with an active connection, which would allow to provide a reliable alerting (we would be supposed to have always active > 0, else it would be an error). I tried configuring:

quarkus.ironjacamar.other.ra.kind=artemis
quarkus.ironjacamar.other.ra.config.connection-parameters=...
quarkus.ironjacamar.other.ra.config.protocol-manager-factory=org.apache.activemq.artemis.core.protocol.hornetq.client.HornetQClientProtocolManagerFactory
quarkus.ironjacamar.other.ra.config.user=...
quarkus.ironjacamar.other.ra.config.password=...
quarkus.ironjacamar.other.ra.cm.pool.config.initial-size=1
quarkus.ironjacamar.other.ra.cm.pool.config.min-size=1
quarkus.ironjacamar.other.ra.cm.pool.config.prefill=true
quarkus.ironjacamar.other.ra.cm.pool.config.strict-min=true

but I keep getting ironjacamar_pool_active_count_total{resourceAdapter="other"} 0.0

it is disturbing because when I start the application the consumer connects successfully (I can see 5 sessions created on each remote broker node), but ironjacamar_pool_active_count_total stays at 0. only when I send the first message, which gets received, do I get ironjacamar_pool_active_count_total{resourceAdapter="other"} 1.0

if I remove the messaging endpoint, ironjacamar_pool_active_count_total is 0 after startup, and 1 after the first send. if there is a message in the queue, and I activate the listener and I restart the app, without sending another message after app startup, the app receives the message, ironjacamar_pool_active_count_total stays at 0

in summary:

gastaldi commented 1 year ago

I'm investigating this and it looks like, for some reason, inflow messages bypass the JCA ConnectionManager's pool (the ResourceAdapter creates them using Artemis JMS Client, not allocating from the ConnectionManager). Still investigating, but it may require changes in the Artemis JMS RA to function properly

gastaldi commented 1 year ago

Just confirmed: the Artemis RA doesn't use the ConnectionManager, therefore the metrics exposed there are for outflow messaging only. I haven't found anything in the spec saying that inflow messaging should use the ConnectionManager, so I guess that's expected.

I created https://issues.apache.org/jira/browse/ARTEMIS-4429 as a new feature.

PS: You also need to change the pool strategy if you plan to prefill it since the default doesn't really allow it (maybe I could display a warning in this case):

quarkus.ironjacamar.other.ra.cm.pool.strategy=one-pool