package ch.rasc.s4ws.twitter;

import javax.annotation.PreDestroy;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.EnableWebSocketMessageBroker;
import org.springframework.messaging.simp.config.MessageBrokerConfigurer;
import org.springframework.messaging.simp.config.StompEndpointRegistry;
import org.springframework.messaging.simp.config.WebSocketMessageBrokerConfigurer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.ITopic;

@Configuration
@EnableWebMvc
@EnableWebSocketMessageBroker
@EnableScheduling
@ComponentScan(basePackages = "ch.rasc.s4ws.twitter")
public class WebConfig extends WebMvcConfigurerAdapter implements WebSocketMessageBrokerConfigurer {

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/").setViewName("index.html");
	}

	@Override
	public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
		configurer.enable();
	}

	@Override
	public void registerStompEndpoints(StompEndpointRegistry registry) {
		registry.addEndpoint("/tweets").withSockJS();
	}

	@Override
	public void configureMessageBroker(MessageBrokerConfigurer configurer) {
		configurer.enableSimpleBroker("/queue/");
	}

	@Bean
	public ITopic<Tweet> hazelcastTopic() {
		HazelcastInstance hc = Hazelcast.newHazelcastInstance();
		return hc.getTopic("tweets");
	}

	@PreDestroy
	public void destroy() {
		Hazelcast.shutdownAll();
	}

}

@@ -20,24 +20,55 @@
 s.twitter;%0A%0A
+import java.util.Collections;%0A%0A
 import javax
@@ -91,16 +91,16 @@
 estroy;%0A
-
 %0Aimport 
@@ -962,24 +962,60 @@
 erAdapter;%0A%0A
+import com.hazelcast.config.Config;%0A
 import com.h
@@ -1934,24 +1934,261 @@
 stTopic() %7B%0A
+%09%09Config config = new Config();%0A%09%09config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);%0A%09%09config.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(Collections.singletonList(%22127.0.0.1%22)).setEnabled(true);%0A%09%09%0A
 %09%09HazelcastI
@@ -2231,16 +2231,22 @@
 nstance(
+config
 );%0A%09%09ret

Use tcpip instead of multicast joiner.