Spring Integration
  1. Spring Integration
  2. INT-2089

allow no-argument Gateway methods to be configured for sending Messages

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.1 M2
    • Component/s: None
    • Labels:
      None

      Description

      The current behavior (which will most likely remain the default) is that a no-arg method on a Gateway interface will be used to receive a Message from a PollableChannel. We should enable a configuration option that can label such methods to be used as send operations if desirable. This would most likely need to go hand-in-hand with a method-specific 'payload-expression'. For example, it might be configured to send a static string, the current date/time, etc.

        Issue Links

          Activity

          Hide
          Christopher Hunt added a comment -

          Would you have a moment to explain how this issue has been resolved? I think I have the same issue as reported on this thread:

          http://forum.springsource.org/showthread.php?103522-no-pollable-reply-channel-has-been-configured

          i.e. I have a gateway with a no-arg method where I want to send on a message to a service activator.

          Thanks!

          Show
          Christopher Hunt added a comment - Would you have a moment to explain how this issue has been resolved? I think I have the same issue as reported on this thread: http://forum.springsource.org/showthread.php?103522-no-pollable-reply-channel-has-been-configured i.e. I have a gateway with a no-arg method where I want to send on a message to a service activator. Thanks!
          Hide
          Mark Fisher added a comment - - edited

          If a no-arg method does have a return value but has no @Payload annotation (on the method itself obviously since there are no params to annotate) or "payload-expression" attribute in XML (on the <method> sub-element), then it will still be treated as before: attempt to receive a Message rather than send-and-receive. However, if a @Payload (which contains a SpEL expression) or a "payload-expression" attribute is provided, then that expression will be used to generate a payload. A few examples of what the payload could be:

          1. a literal string
          2. #method (for the method name)
          3. new java.util.Date()
          4. @someBean.someMethod()'s return value

          If the method has no-args and no return value but does contain a payload expression, it will be treated as a send-only operation.

          Please let me know if that clarifies.

          Show
          Mark Fisher added a comment - - edited If a no-arg method does have a return value but has no @Payload annotation (on the method itself obviously since there are no params to annotate) or "payload-expression" attribute in XML (on the <method> sub-element), then it will still be treated as before: attempt to receive a Message rather than send-and-receive. However, if a @Payload (which contains a SpEL expression) or a "payload-expression" attribute is provided, then that expression will be used to generate a payload. A few examples of what the payload could be: 1. a literal string 2. #method (for the method name) 3. new java.util.Date() 4. @someBean.someMethod()'s return value If the method has no-args and no return value but does contain a payload expression, it will be treated as a send-only operation. Please let me know if that clarifies.

            People

            • Assignee:
              Mark Fisher
              Reporter:
              Mark Fisher
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: