Feeder value #{WEB_ID} not recognized in ChainBuilder (Java) simulation

I have created my first simulation. I used Java as that is my working language.

In my simulation, I have a feeder defined as

FeederBuilder.Batchable<String> **web_ids** = csv(Config.USER_CSV).random();

It does exist as I tried to change the value and it causes a stacktrace.

I am passing the feeder to the scenario using the following

	ScenarioBuilder scn = Save490.getScenario()
	    .feed(**web_ids**);

In the Save490 class, the code in question being executed is.

	    ChainBuilder scn = exec(
		  http("request_0")
//          .get("/bhsol-pssd/prot/system-messages?webid=WEB.109430")  ///   **WORKS**
            .get("/bhsol-pssd/prot/system-messages?webid=#{WEB_ID}")     ///  **/// FAILS**
.....

If I use the commented out line, it works, but when I use the ?webid=#{WEB_ID} it fails with

10:19:34.021 [ERROR] i.g.h.a.HttpRequestAction - 'request_0' failed to execute: No attribute named 'WEB_ID' is defined.

In my CSV file, I have the following.

WEB_ID,UNIQUE_ID
WEB.109430,531E0DA0-AC01-4736-A945-03F60F03200E
WEB.109430,531E0DA0-AC01-4736-A945-03F60F03200E
WEB.109430,531E0DA0-AC01-4736-A945-03F60F03200E

Is there something I am missing in how the feeder is supposed to work?

Not sure as you don’t provide the full code but I suspect you’re attaching feed to your scenario flow AFTER your requests.

In short, I suspect your doing:

exec(
http(“request_0”)
 .get(“/bhsol-pssd/prot/system-messages?webid=#{WEB_ID}”)
).feed(web_ids)

while your should be doing

feed(web_ids)
.exec(
http(“request_0”)
 .get(“/bhsol-pssd/prot/system-messages?webid=#{WEB_ID}”)
)

That fixed it.

In my Save490 class, I created two chains, the first one being only the Feeder that you asked me to pass into the method which is now

	 public static ScenarioBuilder getScenario(**FeederBuilder.Batchable<String> web_ids)** {
              ChainBuilder chain_web_ids = exec().feed(web_ids);		 
  	      ChainBuilder chain_490_Save = exec(
               ...
               );
              return scenario("Process Inbox").exec(chain_web_ids).exec(chain_490_Save);
        }

ChainBuilder chain_web_ids = feed(web_ids);

is enough, no need for this empty exec.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.