Remove @UnsubscribeEvent
The STOMP UNSUBSCRIBE message does not have a destination header so there is no obvious simple way to do a mapping and the need for it is not clear yet.
This commit is contained in:
parent
715a11ce8c
commit
61d13547e1
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002-2013 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.messaging.simp.annotation;
|
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annotation for mapping unsubscribe events onto specific handler methods based
|
|
||||||
* on the destination for the message (e.g. STOMP UNSUBSCRIBE message).
|
|
||||||
*
|
|
||||||
* @author Rossen Stoyanchev
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
public @interface UnsubscribeEvent {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destination value(s) for the subscription.
|
|
||||||
*/
|
|
||||||
String[] value() default {};
|
|
||||||
|
|
||||||
}
|
|
|
@ -65,7 +65,6 @@ import org.springframework.messaging.simp.SimpMessageSendingOperations;
|
||||||
import org.springframework.messaging.simp.SimpMessageType;
|
import org.springframework.messaging.simp.SimpMessageType;
|
||||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||||
import org.springframework.messaging.simp.annotation.SubscribeEvent;
|
import org.springframework.messaging.simp.annotation.SubscribeEvent;
|
||||||
import org.springframework.messaging.simp.annotation.UnsubscribeEvent;
|
|
||||||
import org.springframework.messaging.simp.annotation.support.PrincipalMethodArgumentResolver;
|
import org.springframework.messaging.simp.annotation.support.PrincipalMethodArgumentResolver;
|
||||||
import org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler;
|
import org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler;
|
||||||
import org.springframework.messaging.simp.annotation.support.SubscriptionMethodReturnValueHandler;
|
import org.springframework.messaging.simp.annotation.support.SubscriptionMethodReturnValueHandler;
|
||||||
|
@ -120,8 +119,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati
|
||||||
|
|
||||||
private Map<MappingInfo, HandlerMethod> subscribeMethods = new HashMap<MappingInfo, HandlerMethod>();
|
private Map<MappingInfo, HandlerMethod> subscribeMethods = new HashMap<MappingInfo, HandlerMethod>();
|
||||||
|
|
||||||
private Map<MappingInfo, HandlerMethod> unsubscribeMethods = new HashMap<MappingInfo, HandlerMethod>();
|
|
||||||
|
|
||||||
private final Map<Class<?>, ExceptionHandlerMethodResolver> exceptionHandlerCache =
|
private final Map<Class<?>, ExceptionHandlerMethodResolver> exceptionHandlerCache =
|
||||||
new ConcurrentHashMap<Class<?>, ExceptionHandlerMethodResolver>(64);
|
new ConcurrentHashMap<Class<?>, ExceptionHandlerMethodResolver>(64);
|
||||||
|
|
||||||
|
@ -308,7 +305,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati
|
||||||
|
|
||||||
initHandlerMethods(handler, handlerType, MessageMapping.class, this.messageMethods);
|
initHandlerMethods(handler, handlerType, MessageMapping.class, this.messageMethods);
|
||||||
initHandlerMethods(handler, handlerType, SubscribeEvent.class, this.subscribeMethods);
|
initHandlerMethods(handler, handlerType, SubscribeEvent.class, this.subscribeMethods);
|
||||||
initHandlerMethods(handler, handlerType, UnsubscribeEvent.class, this.unsubscribeMethods);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <A extends Annotation> void initHandlerMethods(Object handler, Class<?> handlerType,
|
private <A extends Annotation> void initHandlerMethods(Object handler, Class<?> handlerType,
|
||||||
|
@ -365,9 +361,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati
|
||||||
else if (SimpMessageType.SUBSCRIBE.equals(messageType)) {
|
else if (SimpMessageType.SUBSCRIBE.equals(messageType)) {
|
||||||
handleMessageInternal(message, this.subscribeMethods);
|
handleMessageInternal(message, this.subscribeMethods);
|
||||||
}
|
}
|
||||||
else if (SimpMessageType.UNSUBSCRIBE.equals(messageType)) {
|
|
||||||
handleMessageInternal(message, this.unsubscribeMethods);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMessageInternal(Message<?> message, Map<MappingInfo, HandlerMethod> handlerMethods) {
|
private void handleMessageInternal(Message<?> message, Map<MappingInfo, HandlerMethod> handlerMethods) {
|
||||||
|
|
Loading…
Reference in New Issue