Skip to content

Commit

Permalink
chore: Add Kafka consumer group setting
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Mar 26, 2020
1 parent c53ac4c commit db265ed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.consol.citrus.kafka.endpoint.KafkaEndpoint;
import com.consol.citrus.kafka.endpoint.KafkaEndpointBuilder;
import com.consol.citrus.kafka.message.KafkaMessage;
import com.consol.citrus.kafka.message.KafkaMessageHeaders;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
Expand All @@ -54,10 +55,12 @@ public void setConnection(DataTable properties) {

String url = connectionProps.getOrDefault("url", "localhost:9092");
String topic = connectionProps.getOrDefault("topic", "test");
String consumerGroup = connectionProps.getOrDefault("consumerGroup", KafkaMessageHeaders.KAFKA_PREFIX + "group");

KafkaEndpointBuilder builder = new KafkaEndpointBuilder()
.server(url)
.topic(topic);
.topic(topic)
.consumerGroup(consumerGroup);

kafka = builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Kafka steps

Background:
Given Kafka connection
| url | localhost:9092 |
| topic | hello |
| consumerGroup | hello-group |

Scenario: Send and receive multiline body
When send message to Kafka with body
"""
{
"message": "Hello from YAKS!"
}
"""
Then expect message in Kafka with body
"""
{
"message": "Hello from YAKS!"
}
"""

0 comments on commit db265ed

Please sign in to comment.