提交 9b551c63 编写于 作者: M Micha Kiener

SPR-6424, conversation annotations

上级 8dd9f1a3
......@@ -23,6 +23,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.conversation.Conversation;
import org.springframework.conversation.ConversationEndingType;
import org.springframework.conversation.JoinMode;
import org.springframework.conversation.manager.ConversationManager;
......@@ -34,9 +35,10 @@ import org.springframework.conversation.manager.ConversationManager;
* specified within the annotation or {@link JoinMode#NEW} as the default.<br/>
* The new conversation is always long running (not a temporary one) and is
* ended by either manually invoke
* {@link ConversationManager#endCurrentConversation()}, invoking the
* {@link Conversation#end()} method on the conversation itself or by placing
* the {@link EndConversation} annotation on a method.<br/>
* {@link ConversationManager#endCurrentConversation(ConversationEndingType)},
* invoking the {@link Conversation#end(ConversationEndingType)} method on the
* conversation itself or by placing the {@link EndConversation} annotation on a
* method.<br/>
* The new conversation is created BEFORE the method itself is invoked as a
* before-advice.
*
......@@ -58,4 +60,15 @@ public @interface BeginConversation {
* @return the join mode to use for creating a new conversation
*/
JoinMode value() default JoinMode.NEW;
/**
* Returns the timeout to be set within the newly created conversation,
* default is <code>-1</code> which means to use the default timeout as
* being configured on the {@link ConversationManager}. A value of
* <code>0</code> means there is no timeout any other positive value is
* interpreted as a timeout in milliseconds.
*
* @return the timeout in milliseconds to be set on the new conversation
*/
long timeout() default -1;
}
......@@ -22,12 +22,14 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.conversation.ConversationEndingType;
import org.springframework.conversation.ConversationListener;
import org.springframework.conversation.manager.ConversationManager;
/**
* This annotation can be placed on a method to end the current conversation. It
* has the same effect as a manual invocation of
* {@link ConversationManager#endCurrentConversation()}.<br/>
* {@link ConversationManager#endCurrentConversation(ConversationEndingType)}.<br/>
* The conversation is ended AFTER the method was invoked as an after-advice.
*
* @author Micha Kiener
......@@ -38,4 +40,13 @@ import org.springframework.conversation.manager.ConversationManager;
@Documented
public @interface EndConversation {
/**
* Returns the qualifier on how the conversation is about to be ended. This
* value will be passed on to any {@link ConversationListener} registered
* with the conversation being ended.
*
* @return the type of ending, {@link ConversationEndingType#SUCCESS} if not
* explicitly specified
*/
ConversationEndingType value() default ConversationEndingType.SUCCESS;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册