@Test public void testSourceUsingChannelName() { String topic = UUID.randomUUID().toString(); Map<String, Object> config = new HashMap<>(); config.put("channel-name", topic); config.put("host", address); config.put("port", port); MqttSource source = new MqttSource(vertx, new MqttConnectorIncomingConfiguration(new MapBasedConfig(config))); List<MqttMessage<?>> messages = new ArrayList<>(); PublisherBuilder<MqttMessage<?>> stream = source.getSource(); stream.forEach(messages::add).run(); await().until(source::isSubscribed); AtomicInteger counter = new AtomicInteger(); new Thread(() -> usage.produceIntegers(topic, 10, null, counter::getAndIncrement)).start(); await().atMost(2, TimeUnit.MINUTES).until(() -> messages.size() >= 10); assertThat(messages.stream() .map(Message::getPayload) .map(x -> (byte[]) x) .map(bytes -> Integer.valueOf(new String(bytes))) .collect(Collectors.toList())) .containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); }
PublisherBuilder<MqttMessage<?>> getSource() { return source; }
MqttSource { PublisherBuilder<MqttMessage<?>> getSource() { return source; } }
MqttSource { PublisherBuilder<MqttMessage<?>> getSource() { return source; } MqttSource(Vertx vertx, MqttConnectorIncomingConfiguration config); }
MqttSource { PublisherBuilder<MqttMessage<?>> getSource() { return source; } MqttSource(Vertx vertx, MqttConnectorIncomingConfiguration config);  }
MqttSource { PublisherBuilder<MqttMessage<?>> getSource() { return source; } MqttSource(Vertx vertx, MqttConnectorIncomingConfiguration config);   }