Force JMS DSL to use separate connections per user

Hey all!

I am currently stuck trying to build a certain JMS scenario and maybe someone here has an idea.

The JMS DSL caches connections per connection factory in a hash map. This absolutely makes sense in regular scenarios.

Now we have the case that we want to run a simulation of a lot of different client apps opening jms connections to our broker.

So far the only way I can think of is to have the scenario run on multiple source hosts which poses it’s own challenges.

Does anyone have an idea how we could force a new connection per virtual user?

I tried having the connection factory object return a random hashcode on each invocation hoping that this would result in misses when checking the hash map but without success.

Another idea was to duplicate the scenario and call that multiple times in the setup method but even then all requests are handled by a single connection.

Any ideas are welcome :slight_smile:

I think I found a way. You can assign a separate instance of the JmsProtocolBuilder to a scenario instead of the whole simulation, which in turn can recieve separate connection factory instances. So by duplicating the ScenarioBuilder, JmsProtocolBuilder and ConnectionFactory I was able to run a simulation sending requests via two different connections :slight_smile:

But it feels very clunky so not sure that is the intended way. In order to scale in this dimension I have to see if I can extract that logic into a function to create fresh instances and unique names for all scenarios.

Maybe there is a “best practice” for this kind of tests?

I’m afraid Gatling’s JMS support is simply not intended for this “army of clients” use case for now, on contrary to the WebSocket and MQTT supports where each virtual user has its own connections.