如何在Spring中注册stomp订阅

时间:2017-11-27 18:21:24

标签: java spring stomp spring-messaging

我想使用spring-messaging v.4.2控制Spring应用程序中的stomp订阅。 这是我的stomp的Spring应用程序配置:

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.myapp")
@EnableWebSocketMessageBroker
@EnableAsync
@EnableScheduling
public class Config extends AbstractWebSocketMessageBrokerConfigurer  {

    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableSimpleBroker("/queue", "/topic");
        config.setApplicationDestinationPrefixes("/app");
        config.setUserDestinationPrefix("/user");
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/pv").setAllowedOrigins("*");
    }

    @Bean
    public Executor taskExecutor() {
        return new SimpleAsyncTaskExecutor();
    }   

    @Bean 
    public MultipartResolver multipartResolver(){
        return new CommonsMultipartResolver();
    }
}

如何使用path和stompId作为参数编写为每个订阅调用的方法? 感谢

0 个答案:

没有答案