use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.
the class ConsumerApplication method getRuntimeModule.
private static Module getRuntimeModule(Properties joynrConfig) {
Module runtimeModule;
Module backendTransportModules = Modules.EMPTY_MODULE;
if (invocationParameters.getRuntimeMode() == RuntimeConfig.WEBSOCKET) {
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST, invocationParameters.getCcHost());
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT, invocationParameters.getCcPort());
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL, "ws");
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH, "");
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
if (invocationParameters.getBackendTransportMode() == BackendConfig.MQTT) {
joynrConfig.put("joynr.messaging.mqtt.brokerUri", invocationParameters.getMqttBrokerUri());
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
} else {
// HTTP
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.
the class IltProviderApplication method getRuntimeModule.
private static Module getRuntimeModule(String[] args, Properties joynrConfig) {
Module runtimeModule;
if (args.length > 1) {
String transport = args[1].toLowerCase();
if (transport.contains("websocketcc")) {
configureWebSocket(joynrConfig);
runtimeModule = new CCWebSocketRuntimeModule();
} else if (transport.contains("websocket")) {
configureWebSocket(joynrConfig);
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
}
Module backendTransportModules = Modules.EMPTY_MODULE;
if (transport.contains("http")) {
LOG.info("Configuring HTTP...");
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
if (transport.contains("mqtt")) {
LOG.info("Configuring MQTT...");
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
return Modules.override(new CCInProcessRuntimeModule()).with(new AtmosphereMessagingModule());
}
use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.
the class ShortCircuitTest method setup.
@Before
public void setup() throws Exception {
Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
Properties joynrConfig = new Properties();
DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, runtimeModule).createApplication(DummyJoynrApplication.class);
runtime = application.getRuntime();
DiscoveryQos discoveryQos = new DiscoveryQos(CONST_DEFAULT_TEST_TIMEOUT, ArbitrationStrategy.HighestPriority, DiscoveryQos.NO_MAX_AGE, DiscoveryScope.LOCAL_ONLY);
ProxyBuilder<EchoProxy> proxyBuilder = runtime.getProxyBuilder(DOMAIN, EchoProxy.class).setDiscoveryQos(discoveryQos);
echoProxy = proxyBuilder.build();
EchoProvider echoProvider = new EchoProviderImpl();
ProviderQos providerQos = new ProviderQos();
providerQos.setPriority(System.currentTimeMillis());
providerQos.setScope(ProviderScope.LOCAL);
runtime.registerProvider(DOMAIN, echoProvider, providerQos);
// warmup
for (int i = 0; i < 100; i++) {
echoProxy.echoString("warmup");
echoProxy.echoByteArray(new Byte[1]);
}
}
use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactory method getInjector.
@Override
public Injector getInjector() {
if (fInjector == null) {
Module jeeModule = override(new CCInProcessRuntimeModule()).with(new JeeJoynrIntegrationModule(scheduledExecutorService));
Module finalModule = override(jeeModule).with(new AbstractModule() {
@Override
protected void configure() {
bind(RawMessagingPreprocessor.class).toInstance(rawMessagePreprocessor);
if (mqttClientIdProvider != null) {
bind(MqttClientIdProvider.class).toInstance(mqttClientIdProvider);
}
bind(MqttStatusReceiver.class).toInstance(mqttStatusReceiver);
bind(StatusReceiver.class).toInstance(statusReceiver);
}
});
fInjector = new JoynrInjectorFactory(joynrProperties, new StaticDomainAccessControlProvisioningModule(), getMessageProcessorsModule(), finalModule).getInjector();
}
return fInjector;
}
use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.
the class ShutdownTest method setup.
@Before
public void setup() {
Properties factoryPropertiesProvider = new Properties();
factoryPropertiesProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain");
factoryPropertiesProvider.put(MessagingPropertyKeys.CHANNELID, "ShutdownTestChannelId");
MockitoAnnotations.initMocks(this);
Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
dummyApplication = (DummyJoynrApplication) new JoynrInjectorFactory(factoryPropertiesProvider, runtimeModule).createApplication(DummyJoynrApplication.class);
provider = new DefaulttestProvider();
providerQos = new ProviderQos();
providerQos.setScope(ProviderScope.LOCAL);
providerQos.setPriority(System.currentTimeMillis());
}
Aggregations