use of io.smallrye.reactive.messaging.providers.connectors.ExecutionHolder in project smallrye-reactive-messaging by smallrye.
the class RabbitMQBrokerTestBase method setup.
@BeforeEach
public void setup() {
executionHolder = new ExecutionHolder(Vertx.vertx());
usage = new AmqpUsage(executionHolder.vertx(), host, port, username, password);
SmallRyeConfigProviderResolver.instance().releaseConfig(ConfigProvider.getConfig());
MapBasedConfig.cleanup();
}
use of io.smallrye.reactive.messaging.providers.connectors.ExecutionHolder in project smallrye-reactive-messaging by smallrye.
the class AwsSnsTestBase method setup.
@BeforeEach
public void setup() {
executionHolder = new ExecutionHolder(Vertx.vertx());
ip = CONTAINER.getContainerIpAddress();
port = CONTAINER.getMappedPort(9911);
LOGGER.debugf("Container IP [%s] port [%d]", ip, port);
}
use of io.smallrye.reactive.messaging.providers.connectors.ExecutionHolder in project smallrye-reactive-messaging by smallrye.
the class KafkaSourceTest method testBroadcastWithPartitions.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testBroadcastWithPartitions() {
companion.topics().createAndWait(topic, 2, Duration.ofMinutes(1));
MapBasedConfig config = newCommonConfigForSource().with("value.deserializer", IntegerDeserializer.class.getName()).with("broadcast", true).with("partitions", 2);
connector = new KafkaConnector();
connector.executionHolder = new ExecutionHolder(vertx);
connector.configurations = UnsatisfiedInstance.instance();
connector.consumerRebalanceListeners = UnsatisfiedInstance.instance();
connector.kafkaCDIEvents = new CountKafkaCdiEvents();
connector.init();
PublisherBuilder<? extends KafkaRecord> builder = (PublisherBuilder<? extends KafkaRecord>) connector.getPublisherBuilder(config);
List<KafkaRecord> messages1 = new ArrayList<>();
List<KafkaRecord> messages2 = new ArrayList<>();
builder.forEach(messages1::add).run();
builder.forEach(messages2::add).run();
companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(topic, i), 10);
await().atMost(2, TimeUnit.MINUTES).until(() -> messages1.size() >= 10);
await().atMost(2, TimeUnit.MINUTES).until(() -> messages2.size() >= 10);
assertThat(messages1.stream().map(KafkaRecord::getPayload).collect(Collectors.toList())).containsExactlyInAnyOrder(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
assertThat(messages2.stream().map(KafkaRecord::getPayload).collect(Collectors.toList())).containsExactlyInAnyOrder(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
}
use of io.smallrye.reactive.messaging.providers.connectors.ExecutionHolder in project smallrye-reactive-messaging by smallrye.
the class KafkaSourceTest method testBroadcast.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testBroadcast() {
MapBasedConfig config = newCommonConfigForSource().with("value.deserializer", IntegerDeserializer.class.getName()).with("broadcast", true);
CountKafkaCdiEvents testEvents = new CountKafkaCdiEvents();
connector = new KafkaConnector();
connector.executionHolder = new ExecutionHolder(vertx);
connector.configurations = UnsatisfiedInstance.instance();
connector.consumerRebalanceListeners = UnsatisfiedInstance.instance();
connector.kafkaCDIEvents = testEvents;
connector.init();
PublisherBuilder<? extends KafkaRecord> builder = (PublisherBuilder<? extends KafkaRecord>) connector.getPublisherBuilder(config);
List<KafkaRecord> messages1 = new ArrayList<>();
List<KafkaRecord> messages2 = new ArrayList<>();
builder.forEach(messages1::add).run();
builder.forEach(messages2::add).run();
companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(topic, i), 10);
await().atMost(2, TimeUnit.MINUTES).until(() -> messages1.size() >= 10);
await().atMost(2, TimeUnit.MINUTES).until(() -> messages2.size() >= 10);
assertThat(messages1.stream().map(KafkaRecord::getPayload).collect(Collectors.toList())).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
assertThat(messages2.stream().map(KafkaRecord::getPayload).collect(Collectors.toList())).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
assertThat(testEvents.firedConsumerEvents.sum()).isEqualTo(1);
assertThat(testEvents.firedProducerEvents.sum()).isEqualTo(0);
}
Aggregations