diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/annotation/Handler.java b/org.springframework.integration/src/main/java/org/springframework/integration/annotation/Handler.java index 386a73339c..db1ff36baa 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/annotation/Handler.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/annotation/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 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. @@ -23,11 +23,21 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - /** * Indicates that a method is capable of handling a message or message payload. - * The method may only accept a single parameter, and the enclosing class should - * be annotated with {@link MessageEndpoint @MessageEndpoint}. + *
+ * A method annotated with @Handler may accept a parameter of type + * {@link org.springframework.integration.message.Message} or of the expected + * Message payload's type. Any type conversion supported by + * {@link org.springframework.beans.SimpleTypeConverter} will be applied to + * the Message payload if necessary. Header values can also be passed as + * Message parameters by using the + * {@link org.springframework.integration.handler.annotation.Header @Header} + * parameter annotation. + *
+ * Return values from the annotated method may be of any type. If the return + * value is not a Message, a reply Message will be created with that object + * as its payload. * * @author Mark Fisher */ diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/aop/Publisher.java b/org.springframework.integration/src/main/java/org/springframework/integration/aop/Publisher.java index f8bb60b97f..128d28e22c 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/aop/Publisher.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/aop/Publisher.java @@ -24,8 +24,10 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Indicates that the method's return value should be published to the specified + * Indicates that the method's return value, thrown exception, or + * invocation arguments should be published to the specified * channel. The value will only be published if non-null. + * The default payload type is 'return value'. * * @author Mark Fisher */ @@ -35,8 +37,15 @@ import java.lang.annotation.Target; @Documented public @interface Publisher { + /** + * name of the channel where Messages should be sent + */ String channel(); + /** + * type of payload to intercept and send + * @see MessagePublishingInterceptor.PayloadType + */ MessagePublishingInterceptor.PayloadType payloadType() default MessagePublishingInterceptor.PayloadType.RETURN_VALUE;