Skip to content

Commit

Permalink
feat: add silent option
Browse files Browse the repository at this point in the history
  • Loading branch information
jigarkhwar committed May 22, 2024
1 parent 46ca837 commit 9fcbdb6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.galaxio.gatling.kafka.actions

import com.softwaremill.quicklens._
import io.gatling.core.action.Action
import io.gatling.core.action.builder.ActionBuilder
import io.gatling.core.structure.ScenarioContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import io.gatling.core.structure.ScenarioContext
import io.gatling.core.util.NameGen
import org.galaxio.gatling.kafka.KafkaCheck
import org.galaxio.gatling.kafka.protocol.KafkaProtocol
import org.galaxio.gatling.kafka.request.builder.{KafkaRequestReplyAttributes, RequestBuilder}
import org.galaxio.gatling.kafka.request.builder.KafkaRequestReplyAttributes

import scala.reflect.ClassTag

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.galaxio.gatling.kafka.protocol

import io.gatling.core.session.Expression
import org.apache.kafka.clients.producer.ProducerConfig
import org.apache.kafka.common.serialization.Serdes
import org.apache.kafka.streams.StreamsConfig
import KafkaProtocol._
import org.galaxio.gatling.kafka.protocol.KafkaProtocol._
import org.galaxio.gatling.kafka.request.KafkaProtocolMessage

import scala.concurrent.duration.{DurationInt, FiniteDuration}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ case class KafkaRequestBuilderBase(requestName: Expression[String]) {
payload: Expression[V],
headers: Expression[Headers] = List.empty[Header],
silent: Boolean = false,
)(implicit
sender: Sender[K, V],
): RequestBuilder[K, V] = {
if (key == null)
sender.send(requestName, None, payload, Some(headers), Some(silent))
else
sender.send(requestName, Some(key), payload, Some(headers), Some(silent))
}
)(implicit sender: Sender[K, V]): RequestBuilder[K, V] = if (key == null)
sender.send(requestName, None, payload, Some(headers), Some(silent))
else
sender.send(requestName, Some(key), payload, Some(headers), Some(silent))

def send[V](payload: Expression[V])(implicit
sender: Sender[Nothing, V],
headers: Expression[Headers] = List.empty[Header],
silent: Boolean = false,
): RequestBuilder[_, V] =
sender.send(requestName = requestName, key = None, payload = payload, headers = None, silent = None)
sender.send(requestName = requestName, key = None, payload = payload, headers = Some(headers), silent = Some(silent))

def requestReply: ReqRepBase.type = ReqRepBase

Expand Down

0 comments on commit 9fcbdb6

Please sign in to comment.