io.smallrye.reactive.messaging.extension.MediatorManager Java Examples
The following examples show how to use
io.smallrye.reactive.messaging.extension.MediatorManager.
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: 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 #2
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 #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: 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 #5
Source File: WeldTestBaseWithoutTails.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Before public void setUp() { initializer = SeContainerInitializer.newInstance(); initializer.addBeanClasses(MediatorFactory.class, ExecutionHolder.class, MediatorManager.class, WorkerPoolRegistry.class, InternalChannelRegistry.class, ChannelProducer.class, ConfiguredChannelFactory.class, LegacyConfiguredChannelFactory.class, MetricDecorator.class, // Messaging provider MyDummyConnector.class, // SmallRye config io.smallrye.config.inject.ConfigProducer.class); List<Class<?>> beans = getBeans(); initializer.addBeanClasses(beans.toArray(new Class<?>[0])); initializer.disableDiscovery(); initializer.addExtensions(new ReactiveMessagingExtension()); }
Example #6
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 #7
Source File: ConnectionSharingTest.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Test public void testWithClientId() { Clients.clear(); Weld weld = baseWeld(getConfig()); weld.addBeanClass(App.class); container = weld.initialize(); App bean = container.getBeanManager().createInstance().select(App.class).get(); await().until(() -> this.container.select(MediatorManager.class).get().isInitialized()); await() .until(() -> this.container.select(MqttConnector.class, ConnectorLiteral.of("smallrye-mqtt")).get().isReady()); await().atMost(2, TimeUnit.MINUTES).until(() -> bean.prices().size() >= 10); assertThat(bean.prices()).isNotEmpty(); }
Example #8
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 #9
Source File: MqttSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Test public void testABeanConsumingTheMQTTMessages() { ConsumptionBean bean = deploy(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); await() .until(() -> container.select(MqttConnector.class, ConnectorLiteral.of("smallrye-mqtt")).get().isReady()); List<Integer> list = bean.getResults(); assertThat(list).isEmpty(); AtomicInteger counter = new AtomicInteger(); new Thread(() -> usage.produceIntegers("data", 10, null, counter::getAndIncrement)) .start(); await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10); assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); }
Example #10
Source File: WeldTestBase.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
@Before public void setUp() { initializer = SeContainerInitializer.newInstance(); initializer.addBeanClasses(MediatorFactory.class, MediatorManager.class, WorkerPoolRegistry.class, ExecutionHolder.class, InternalChannelRegistry.class, ChannelProducer.class, ConfiguredChannelFactory.class, LegacyConfiguredChannelFactory.class, MetricDecorator.class, // In memory connector InMemoryConnector.class, // SmallRye config io.smallrye.config.inject.ConfigProducer.class); List<Class<?>> beans = getBeans(); initializer.addBeanClasses(beans.toArray(new Class<?>[0])); initializer.disableDiscovery(); initializer.addExtensions(new ReactiveMessagingExtension()); }
Example #11
Source File: MultipleTopicsConsumptionTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testWithoutClientId() { Clients.clear(); Weld weld = baseWeld(getConfig(null)); weld.addBeanClass(Consumers.class); container = weld.initialize(); Consumers bean = container.getBeanManager().createInstance().select(Consumers.class).get(); await().until(() -> this.container.select(MediatorManager.class).get().isInitialized()); await() .until(() -> this.container.select(MqttConnector.class, ConnectorLiteral.of("smallrye-mqtt")).get().isReady()); assertThat(bean.prices()).isEmpty(); assertThat(bean.products()).isEmpty(); AtomicInteger counter1 = new AtomicInteger(); AtomicInteger counter2 = new AtomicInteger(); new Thread(() -> usage.produceIntegers("prices", 10, null, counter1::getAndIncrement)) .start(); new Thread(() -> usage.produceIntegers("products", 10, null, counter2::getAndIncrement)) .start(); await().atMost(2, TimeUnit.MINUTES).until(() -> bean.products().size() >= 10); await().atMost(2, TimeUnit.MINUTES).until(() -> bean.prices().size() >= 10); }
Example #12
Source File: IncomingsTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test(expected = DeploymentException.class) public void testIncomingsWithMissingSourceInStrictMode() { System.setProperty(MediatorManager.STRICT_MODE_PROPERTY, "true"); addBeanClass(ProducerOnB.class); addBeanClass(MyBeanUsingMultipleIncomings.class); initialize(); }
Example #13
Source File: SecureMqttSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testABeanConsumingTheMQTTMessagesWithAuthentication() { ConsumptionBean bean = deploy(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); List<Integer> list = bean.getResults(); assertThat(list).isEmpty(); AtomicInteger counter = new AtomicInteger(); new Thread(() -> usage.produceIntegers("data", 10, null, counter::getAndIncrement)) .start(); await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10); assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); }
Example #14
Source File: MultipleTopicsConsumptionTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testWithClientId() { Clients.clear(); Weld weld = baseWeld(getConfig("my-id")); weld.addBeanClass(Consumers.class); container = weld.initialize(); Consumers bean = container.getBeanManager().createInstance().select(Consumers.class).get(); await().until(() -> this.container.select(MediatorManager.class).get().isInitialized()); await() .until(() -> this.container.select(MqttConnector.class, ConnectorLiteral.of("smallrye-mqtt")).get().isReady()); assertThat(bean.prices()).isEmpty(); assertThat(bean.products()).isEmpty(); AtomicInteger counter1 = new AtomicInteger(); AtomicInteger counter2 = new AtomicInteger(); new Thread(() -> usage.produceIntegers("prices", 10, null, counter1::getAndIncrement)) .start(); new Thread(() -> usage.produceIntegers("products", 10, null, counter2::getAndIncrement)) .start(); await().atMost(2, TimeUnit.MINUTES).until(() -> bean.products().size() >= 10); await().atMost(2, TimeUnit.MINUTES).until(() -> bean.prices().size() >= 10); }
Example #15
Source File: FailureHandlerTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private MyReceiverBean deploy() { Weld weld = new Weld(); weld.addBeanClass(MyReceiverBean.class); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); return container.getBeanManager().createInstance().select(MyReceiverBean.class).get(); }
Example #16
Source File: AmqpSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testConfigGlobalOptionsByCDICorrect() { Weld weld = new Weld(); weld.addBeanClass(ClientConfigurationBean.class); weld.addBeanClass(ConsumptionBean.class); new MapBasedConfig() .put("mp.messaging.incoming.data.address", "data") .put("mp.messaging.incoming.data.connector", AmqpConnector.CONNECTOR_NAME) .put("mp.messaging.incoming.data.host", host) .put("mp.messaging.incoming.data.port", port) .put("amqp-username", username) .put("amqp-password", password) .put("amqp-client-options-name", "myclientoptions") .write(); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); List<Integer> list = container.select(ConsumptionBean.class).get().getResults(); assertThat(list).isEmpty(); AtomicInteger counter = new AtomicInteger(); usage.produceTenIntegers("data", counter::getAndIncrement); await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10); assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); }
Example #17
Source File: AmqpSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testConfigByCDICorrect() { Weld weld = new Weld(); weld.addBeanClass(ClientConfigurationBean.class); weld.addBeanClass(ConsumptionBean.class); new MapBasedConfig() .put("mp.messaging.incoming.data.address", "data") .put("mp.messaging.incoming.data.connector", AmqpConnector.CONNECTOR_NAME) .put("mp.messaging.incoming.data.host", host) .put("mp.messaging.incoming.data.port", port) .put("amqp-username", username) .put("amqp-password", password) .put("mp.messaging.incoming.data.client-options-name", "myclientoptions") .write(); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); List<Integer> list = container.select(ConsumptionBean.class).get().getResults(); assertThat(list).isEmpty(); AtomicInteger counter = new AtomicInteger(); usage.produceTenIntegers("data", counter::getAndIncrement); await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10); assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); }
Example #18
Source File: AmqpSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private ConsumptionBean deploy() { Weld weld = new Weld(); weld.addBeanClass(ConsumptionBean.class); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); return container.getBeanManager().createInstance().select(ConsumptionBean.class).get(); }
Example #19
Source File: AmqpFailureHandlerTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private MyReceiverBean deploy() { Weld weld = new Weld(); weld.addBeanClass(MyReceiverBean.class); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); return container.getBeanManager().createInstance().select(MyReceiverBean.class).get(); }
Example #20
Source File: FailureHandlerTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private MyReceiverBean deploy() { Weld weld = new Weld(); weld.addBeanClass(MyReceiverBean.class); container = weld.initialize(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); return container.getBeanManager().createInstance().select(MyReceiverBean.class).get(); }
Example #21
Source File: EventBusSourceTest.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
@Test public void testABeanConsumingTheEventBusMessages() { ConsumptionBean bean = deploy(); await().until(() -> container.select(MediatorManager.class).get().isInitialized()); List<Integer> list = bean.getResults(); assertThat(list).isEmpty(); bean.produce(); await().atMost(2, TimeUnit.MINUTES).until(() -> list.size() >= 10); assertThat(list).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); }
Example #22
Source File: IncomingsTest.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@After public void cleanup() { System.clearProperty(MediatorManager.STRICT_MODE_PROPERTY); }
Example #23
Source File: SmallRyeReactiveMessagingRecorder.java From quarkus with Apache License 2.0 | 4 votes |
public void configureEmitter(BeanContainer container, EmitterConfiguration ec, long defaultBufferSize) { MediatorManager mediatorManager = container.instance(MediatorManager.class); mediatorManager.initializeEmitter(ec, defaultBufferSize); }
Example #24
Source File: SmallRyeReactiveMessagingRecorder.java From quarkus with Apache License 2.0 | 4 votes |
public void registerMediators(List<QuarkusMediatorConfiguration> configurations, BeanContainer container) { MediatorManager mediatorManager = container.instance(MediatorManager.class); mediatorManager.addAnalyzed(configurations); }