List of usage examples for org.springframework.integration.mqtt.core DefaultMqttPahoClientFactory setServerURIs
@Deprecated public void setServerURIs(String... serverURIs)
From source file:org.createnet.raptor.auth.service.Application.java
@Bean public MqttPahoClientFactory mqttClientFactory() { DispatcherConfiguration config = (DispatcherConfiguration) ConfigurationLoader .getConfiguration("dispatcher", DispatcherConfiguration.class); DefaultMqttPahoClientFactory f = new DefaultMqttPahoClientFactory(); f.setUserName(config.username);//from w w w.j a v a 2 s. com f.setPassword(config.password); f.setServerURIs(config.uri); f.setCleanSession(true); f.setPersistence(new MemoryPersistence()); return f; }
From source file:org.springframework.integration.mqtt.MqttAdapterTests.java
private MqttPahoMessageDrivenChannelAdapter buildAdapter(final IMqttClient client, Boolean cleanSession, ConsumerStopAction action) throws MqttException, MqttSecurityException { DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory() { @Override/*from w w w . j a v a 2 s . c o m*/ public IMqttClient getClientInstance(String uri, String clientId) throws MqttException { return client; } }; factory.setServerURIs("tcp://localhost:1883"); if (cleanSession != null) { factory.setCleanSession(cleanSession); } if (action != null) { factory.setConsumerStopAction(action); } given(client.isConnected()).willReturn(true); MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter("client", factory, "foo"); adapter.setApplicationEventPublisher(mock(ApplicationEventPublisher.class)); adapter.setOutputChannel(new NullChannel()); adapter.setTaskScheduler(mock(TaskScheduler.class)); adapter.afterPropertiesSet(); return adapter; }