List of usage examples for org.springframework.integration.mqtt.core DefaultMqttPahoClientFactory setConsumerStopAction
public void setConsumerStopAction(ConsumerStopAction consumerStopAction)
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//www. j a v a2 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; }