diff options
author | Vitaly Takmazov | 2017-11-02 16:02:17 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-11-02 16:12:40 +0300 |
commit | ee20020d9c576a48173c13b68b03d349c0ec3e47 (patch) | |
tree | 7c59dcac74cde4e5b819a245dc0fbbb315020f10 /juick-api/src/main/java/com/juick/api/configuration | |
parent | 61c6a3fe338a5cbbef55081f8ac26011c053125d (diff) |
server-web: base websocket component with autoreconnect
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/configuration')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java | 22 | ||||
-rw-r--r-- | juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java | 4 |
2 files changed, 9 insertions, 17 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java index f51528bf..69a2438d 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java @@ -19,6 +19,8 @@ package com.juick.api.configuration; import com.juick.api.ApiServer; import com.juick.api.TelegramBotManager; +import com.juick.server.component.JuickServerComponent; +import com.juick.server.component.JuickServerReconnectManager; import com.juick.server.configuration.BaseWebConfiguration; import com.juick.service.ImagesService; import com.juick.service.ImagesServiceImpl; @@ -44,36 +46,24 @@ import java.util.Collections; * Created by aalexeev on 11/12/16. */ @Configuration -@EnableScheduling @EnableAsync @EnableWebMvc @EnableSwagger2 @PropertySource("classpath:juick.conf") @ComponentScan(basePackages = "com.juick.api") public class ApiAppConfiguration extends BaseWebConfiguration { - @Inject - TelegramBotManager telegramBotManager; - - @Value("${websocket_url:ws://localhost:8080/ws/}") - private String WS_URI; - @Bean - public WebSocketConnectionManager connectionManager() { - WebSocketConnectionManager manager = new WebSocketConnectionManager(client(), telegramBotManager, WS_URI); - manager.setAutoStartup(true); - return manager; + public JuickServerComponent juickServerComponent() { + return new JuickServerComponent(); } - @Bean - public StandardWebSocketClient client() { - return new StandardWebSocketClient(); + public JuickServerReconnectManager juickServerReconnectManager() { + return new JuickServerReconnectManager(); } - @Bean public ApiServer apiServer() { return new ApiServer(); } - @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java index 59c69926..3380df10 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java @@ -18,6 +18,7 @@ package com.juick.api.configuration; import com.juick.configuration.DataConfiguration; +import com.juick.server.configuration.JuickServerComponentConfiguration; import com.juick.server.configuration.StorageConfiguration; import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; @@ -35,7 +36,8 @@ public class ApiInitializer extends AbstractAnnotationConfigDispatcherServletIni return new Class<?>[]{ ApiSecurityConfig.class, DataConfiguration.class, - StorageConfiguration.class + StorageConfiguration.class, + JuickServerComponentConfiguration.class }; } |