Announcement Announcement Module
Collapse
No announcement yet.
The method argument of Service activator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • The method argument of Service activator

    The declared method of service activator in almost all the samples demonstrated has only one argument. Then if the method has more than one arguments, how should I build the message to be transported? Pass an object array of auguments as the message payload, or any other approach? Could you give me a sample? Thanks a lot.

  • #2
    The service activator has a single argument, because the intent is for this argument to represent the message itself, or, in the case of a POJO implementation, the message payload.

    If you have a multi-argument method that you want to set up in a service activator, one easy solution is to implement an adapter that receives the payload as an argument and invokes the multi-argument method.

    Comment


    • #3
      Hmmm, an interesting feature would be to allow a payload to be a set of objects and trigger which goes where with a parameter annotation. Somewhat like what we do in Spring MVC.

      @ServiceActivator(...)
      public Result someMethod(@PayloadPart("partA") A a, @Header("b") B b)

      But that's definitely not supported now. If you want it you should create a feature request in JIRA for it.

      Comment


      • #4
        This is the type of thing that we will likely support in 1.1+ after adding EL support. In fact, this would only scratch the surface.

        Comment

        Working...
        X