Skip to content

Commit

Permalink
Merge pull request #71 from christophd/pr/add-kafka-consumer-group
Browse files Browse the repository at this point in the history
chore: Add Kafka consumer group setting
  • Loading branch information
christophd authored Mar 26, 2020
2 parents c53ac4c + e7b7e1c commit eeda69d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public ConnectionFactory create(Map<String, String> properties) {

@Override
public boolean supports(Class<?> type) {
return ActiveMQConnectionFactory.class.equals(type);
return "org.apache.activemq.ActiveMQConnectionFactory".equals(type.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

package org.citrusframework.yaks.jms.connection.activemq.artemis;

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;

import org.citrusframework.yaks.jms.connection.ConnectionFactoryCreator;

import javax.jms.ConnectionFactory;
import javax.jms.JMSException;

import java.util.Map;

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.citrusframework.yaks.jms.connection.ConnectionFactoryCreator;

public class ActiveMQArtemisConnectionFactoryCreator implements ConnectionFactoryCreator {

@Override
Expand Down Expand Up @@ -53,6 +51,6 @@ public ConnectionFactory create(Map<String, String> properties) {

@Override
public boolean supports(Class<?> type) {
return ActiveMQConnectionFactory.class.equals(type);
return "org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory".equals(type.getName());
}
}
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 eeda69d

Please sign in to comment.