# Custom feeder repeats only first line

**URL:** <https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937>\
**Category:** Gatling (Open-Source)\
**Created:** [January 26, 2015, 8:37pm UTC](https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937 "2015-01-26T20:37:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serega\_Sheypak](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Serega\_Sheypak](https://community.gatling.io/u/Serega_Sheypak)\
**Post date:** [January 26, 2015, 8:37pm UTC](https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937/1 "2015-01-26T20:37:35Z")

</div>

Hi, I have a function which returns feeder data, it’s dead simple synthetic.

```auto
def generateFeeder(limit :Int) :Array[Map[String,String]] = {
  import scala.collection.mutable.ListBuffer
  //some stuff here
  list.toArray
}

```

I print generateFeeder result to console and see that I have different records

Here is my code:

```auto
val historyScn = scenario(nameHistoryScn)
  .feed(generateFeeder(limit).queue)
  .repeat(limit){
    exec(
      http("Setting up data for test")
        .post(postHistory)
        .param(visitParam, "${visit}")
        .check(status.is(200))
    ).pause(5 seconds)
  }    

setUp(
  historyScn.inject(atOnce(1))
).protocols(httpConf)

```

and gatling sends only first line limit times  
limit is equal to feeder items count. I want gatling to send all records, not just the first record X times.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 26, 2015, 8:45pm UTC](https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937/2 "2015-01-26T20:45:17Z")

</div>

Move feed inside the repeat loop.

---

<div class="post-metadata">

**Author:** ![Serega\_Sheypak](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Serega\_Sheypak](https://community.gatling.io/u/Serega_Sheypak)\
**Post date:** [January 26, 2015, 9:34pm UTC](https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937/3 "2015-01-26T21:34:57Z")

</div>

Thanks,

```auto
val historyScn = scenario(nameHistoryScn)
  .repeat(limit){
    feed(generateFeeder(userId, shopId, limit).queue)
    .exec(

```

works! problem is solved.

---

<div class="post-metadata">

**Author:** ![Abhinav\_Gogna](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Abhinav\_Gogna](https://community.gatling.io/u/Abhinav_Gogna)\
**Post date:** [January 26, 2015, 10:12pm UTC](https://community.gatling.io/t/custom-feeder-repeats-only-first-line/1937/4 "2015-01-26T22:12:31Z")

</div>

Interesting! I thought to use custom functions, you have to call exec(session=\> … I guess I learnt something new today. Thanks Serega!
