assigning custom jndi properties

Hello
In the JMS protocol, I have tried to add the custom jndiProperties in the jmsJndiConnectionFactory, but couldn’t the find the exact format of how to add it.
In intelliJ it mentioned as the type: Map[String,String], so I gave like below

.jndiProperties(Map("port" -> "1420"))

and I got the compilation error as below

04:51:42.787 [main][ERROR][ZincCompiler.scala:153] i.g.c.ZincCompiler$ - H:\GatlingScripts\sampleJms\src\test\scala\jmsSimulation.scala:12:24: type mismatch;
found : scala.collection.immutable.Map[String,String]
required: String
.jndiProperties(Map(“port” → “1420”))

I have tried in different format as well, couldn’t get it to work. I couldnt find an example about this in the Gatling Doc as well
Pls help with this

Thanks
Sujin Sam

That’s property (one by one):
https://gatling.io/docs/current/jms#jms-jndi-connection-factory

Excerpt from the requirements for posting on this mailing list
<https://groups.google.com/g/gatling>:
*Make sure you're using an up-to-date Gatling version*

My best guess is that you're not running the latest version (3.3.1 as of
now) and that this feature is missing from this version.

[image: Logo] <https://gatling.io>
*Stéphane Landelle**Chief Technical Officer*
twitter: @slandelle <https://twitter.com/slandelle>
site: gatling.io

Hello Stephane

I have a doubt here, I need to add some custom jndi properties

  • do we need to add the custom jndi property in jmsJndiConnectionFactory object or adding it in the exec builder(like the example in the doc) is enough?

  • if we need to add in the jmsJndiConnectionFactory object, then I tried the below two steps:

  1. adding property value in the jmsJndiConnectionFactory as per the doc

val jndiBasedConnectionFactory = jmsJndiConnectionFactory
.connectionFactoryName("CONNECTION_FACTORY")
.url("")
.contextFactory("com.*.jms.InitialContextFactory")
.property("channel","MQ_IS")

It threw this error:

11:24:35.782 [main][ERROR][ZincCompiler.scala:153] i.g.c.ZincCompiler$ - H:\GatlingScripts\sampleJms\src\test\scala\jmsSimulation.scala:13:6: value property is not a member of io.gatling
.jms.jndi.JmsJndiConnectionFactoryBuilder
possible cause: maybe a semicolon is missing before `value property’?
.property(“channel”,“MQ_IS”)

  1. IntelliJ suggests that jndiProperties value is available for the jmsJndiConnectionFactory object ( what is this? is this same as property?)
    So, I tried as below

val jndiBasedConnectionFactory = jmsJndiConnectionFactory
.connectionFactoryName("CONNECTION_FACTORY")
.url("")
.contextFactory("com.*.jms.InitialContextFactory")
.jndiProperties("channel","MQ_IS")

it failed as below:

11:26:23.536 [main][ERROR][ZincCompiler.scala:153] i.g.c.ZincCompiler$ - H:\GatlingScripts\sampleJms\src\test\scala\jmsSimulation.scala:13:31: too many arguments (2) for method apply: (k
ey: String)String in trait MapLike
.jndiProperties(“channel”,“MQ_IS”)

I found this while googling about it : https://github.com/gatling/gatling/pull/3262
I’m not an expert in JMS side
can you pls help with it?

was thinking to add the version but forgot
checked the pom.xml, its the latest version 3.3.1

`

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
UTF-8

<gatling.version>3.3.1</gatling.version>
<gatling-maven-plugin.version>3.0.5</gatling-maven-plugin.version>

`

Hello,

Please, try with property method before the call to contextFactory.

Based on your example:

val jndiBasedConnectionFactory = jmsJndiConnectionFactory
.connectionFactoryName(“CONNECTION_FACTORY”)
.url("")
.property(“channel”, “MQ_IS”)
.contextFactory(“com.*.jms.InitialContextFactory”)

Thanks Sebastien, that worked