# custom feeders implementation

**URL:** <https://community.gatling.io/t/custom-feeders-implementation/403>\
**Category:** Gatling (Open-Source)\
**Created:** [June 1, 2013, 12:48am UTC](https://community.gatling.io/t/custom-feeders-implementation/403 "2013-06-01T00:48:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [June 1, 2013, 12:48am UTC](https://community.gatling.io/t/custom-feeders-implementation/403/1 "2013-06-01T00:48:54Z")

</div>

I am new to use scala and gatling. Wondering if you can give me some suggestions on how to do this:

I am trying to implement my own feeder function, which basically is reading a csv file and then massage the data and return for the httpconfig to use:

e,g, I have the feed file as groups.csv

groupname,grouptype

the custom feeder will return groupname+"/community" if grouptype is community, and return groupname + “/others” when grouptype is group. There is a sample code here: [https://github.com/excilys/gatling/wiki/Feeders](https://github.com/excilys/gatling/wiki/Feeders)

But that one randomly create the data. For me, I need to get each record from the csv file first and then manupulate the data accordingly and then feed it back to the httpConfig.

Thx advance for the help!

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [June 1, 2013, 5:39am UTC](https://community.gatling.io/t/custom-feeders-implementation/403/2 "2013-06-01T05:39:42Z")

</div>

csv(“groups.csv”).map{  
case header @ List(“groupname”, “grouptype”) =\> header

case List(groupname, “community”) =\> List(groupname + “/community”)  
case List(groupname, \_) =\> List(groupname + “/others”)  
case r =\> throw new IllegalArgumentException("Unexpected record " + r)  
}

csv produces an Array[Map[String, String]], so you just have to map it.

If you want to learn some Scala basics, I advice you have a look at the Twitter’s Scala School first chapters: [http://twitter.github.io/scala\_school/](http://twitter.github.io/scala_school/)

Cheers,

Stéphane
