Java Code Examples for org.jboss.weld.environment.se.Weld#disableDiscovery()
The following examples show how to use
org.jboss.weld.environment.se.Weld#disableDiscovery() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 7 votes |
protected Weld initWithoutConnectionFactory() { weld = new Weld(); // SmallRye config ConfigExtension extension = new ConfigExtension(); weld.addExtension(extension); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(ChannelProducer.class); weld.addBeanClass(ExecutionHolder.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(JmsConnector.class); weld.disableDiscovery(); return weld; }
Example 2
Source File: AwsSnsTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 7 votes |
static Weld baseWeld() { Weld weld = new Weld(); // SmallRye config ConfigExtension extension = new ConfigExtension(); weld.addExtension(extension); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(ChannelProducer.class); weld.addBeanClass(ExecutionHolder.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(SnsConnector.class); weld.disableDiscovery(); return weld; }
Example 3
Source File: EventbusTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
static Weld baseWeld() { Weld weld = new Weld(); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(ExecutionHolder.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(VertxEventBusConnector.class); weld.addExtension(new io.smallrye.config.inject.ConfigExtension()); weld.disableDiscovery(); return weld; }
Example 4
Source File: MqttTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
static Weld baseWeld(MapBasedConfig config) { addConfig(config); Weld weld = new Weld(); weld.disableDiscovery(); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addBeanClass(ExecutionHolder.class); weld.addPackages(EmitterImpl.class.getPackage()); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(MqttConnector.class); // Add SmallRye Config weld.addExtension(new io.smallrye.config.inject.ConfigExtension()); return weld; }
Example 5
Source File: PubSubTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
static Weld baseWeld() { final Weld weld = new Weld(); weld.addExtension(new ConfigExtension()); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(ChannelProducer.class); weld.addBeanClass(ExecutionHolder.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(PubSubManager.class); weld.addBeanClass(PubSubConnector.class); weld.disableDiscovery(); return weld; }
Example 6
Source File: DocumentationTest.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Test public void testKafkaPriceConsumer() throws InterruptedException { MapBasedConfig config = getConsumerConfiguration(); Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(KafkaPriceConsumer.class); weld.disableDiscovery(); container = weld.initialize(); KafkaPriceConsumer consumer = container.select(KafkaPriceConsumer.class).get(); // TODO we need some readiness support in the connector Thread.sleep(1000); KafkaUsage usage = new KafkaUsage(); AtomicInteger count = new AtomicInteger(); usage.produceDoubles(50, null, () -> new ProducerRecord<>("prices", count.incrementAndGet() * 1.0)); await().until(() -> consumer.list().size() >= 50); }
Example 7
Source File: DocumentationTest.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Test public void testMessageKafkaPriceConsumer() throws InterruptedException { MapBasedConfig config = getConsumerConfiguration(); Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(KafkaPriceMessageConsumer.class); weld.disableDiscovery(); container = weld.initialize(); KafkaPriceMessageConsumer consumer = container.select(KafkaPriceMessageConsumer.class).get(); // TODO we need some readiness support in the connector Thread.sleep(1000); KafkaUsage usage = new KafkaUsage(); AtomicInteger count = new AtomicInteger(); usage.produceDoubles(50, null, () -> new ProducerRecord<>("prices", count.incrementAndGet() * 1.0)); await().until(() -> consumer.list().size() >= 50); }
Example 8
Source File: KafkaTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
public static Weld baseWeld() { Weld weld = new Weld(); // SmallRye config ConfigExtension extension = new ConfigExtension(); weld.addExtension(extension); weld.addBeanClass(MediatorFactory.class); weld.addBeanClass(MediatorManager.class); weld.addBeanClass(InternalChannelRegistry.class); weld.addBeanClass(ConfiguredChannelFactory.class); weld.addBeanClass(ChannelProducer.class); weld.addBeanClass(ExecutionHolder.class); weld.addBeanClass(WorkerPoolRegistry.class); weld.addExtension(new ReactiveMessagingExtension()); weld.addBeanClass(KafkaConnector.class); weld.disableDiscovery(); return weld; }
Example 9
Source File: DocumentationTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testKafkaPriceProducer() { KafkaUsage usage = new KafkaUsage(); List<Double> list = new CopyOnWriteArrayList<>(); usage.consumeDoubles("prices", 50, 60, TimeUnit.SECONDS, null, (s, v) -> list.add(v)); MapBasedConfig config = getProducerConfiguration(); Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(KafkaPriceProducer.class); weld.disableDiscovery(); container = weld.initialize(); await().until(() -> list.size() >= 50); }
Example 10
Source File: DocumentationTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testKafkaPriceMessageProducer() { KafkaUsage usage = new KafkaUsage(); List<Double> list = new CopyOnWriteArrayList<>(); usage.consumeDoubles("prices", 50, 60, TimeUnit.SECONDS, null, (s, v) -> list.add(v)); MapBasedConfig config = getProducerConfiguration(); Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(KafkaPriceMessageProducer.class); weld.disableDiscovery(); container = weld.initialize(); await().until(() -> list.size() >= 50); }
Example 11
Source File: KafkaSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private BeanManager getBeanManager() { if (container == null) { Weld weld = baseWeld(); addConfig(new MapBasedConfig(new HashMap<>())); weld.disableDiscovery(); container = weld.initialize(); } return container.getBeanManager(); }
Example 12
Source File: KafkaSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private ConsumptionBean deploy(MapBasedConfig config) { Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(ConsumptionBean.class); weld.addBeanClass(ConsumptionConsumerRebalanceListener.class); weld.disableDiscovery(); container = weld.initialize(); return container.getBeanManager().createInstance().select(ConsumptionBean.class).get(); }
Example 13
Source File: KafkaSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private ConsumptionBeanWithoutAck deployWithoutAck(MapBasedConfig config) { Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(ConsumptionBeanWithoutAck.class); weld.addBeanClass(ConsumptionConsumerRebalanceListener.class); weld.addBeanClass(StartFromFifthOffsetFromLatestConsumerRebalanceListener.class); weld.addBeanClass(StartFromFifthOffsetFromLatestButFailOnFirstConsumerRebalanceListener.class); weld.addBeanClass(StartFromFifthOffsetFromLatestButFailUntilSecondRebalanceConsumerRebalanceListener.class); weld.disableDiscovery(); container = weld.initialize(); return container.getBeanManager().createInstance().select(ConsumptionBeanWithoutAck.class).get(); }
Example 14
Source File: KafkaSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private ConsumptionBeanUsingRawMessage deployRaw(MapBasedConfig config) { Weld weld = baseWeld(); addConfig(config); weld.addBeanClass(ConsumptionBeanUsingRawMessage.class); weld.disableDiscovery(); container = weld.initialize(); return container.getBeanManager().createInstance().select(ConsumptionBeanUsingRawMessage.class).get(); }