Spring Integration Java DSL - @ServiceActivator method with @Header parameter annotations -


i have spring integration 4 bean method following signature:

@component public class aservice {      @serviceactivator     public message<?> servicemethod(             message<?> message,             @header(serviceheader.a_state) astate state,             @header(serviceheader.a_id) string id) {          ...     }      ... } 

at moment, call service method within spring integration java dsl (spring-integration-java-dsl:1.0.1.release) flow this:

.handle("aservice", "servicemethod") 

this works absolutely fine but, wondering whether possible call service method in following sort of way:

.handle(message.class, (m, h) -> aservice.servicemethod(m, h)) 

the reason call service method in sort of manner that, when looking @ code using ide such eclipse, can drill service's method example highlighting method , pressing f3.

so question is, there alternative way calling @serviceactivator method (which includes @header annotations) without using strings service name/service method in .handle()?

not exactly, can't pass whole message , selected headers, can pass payload , individual headers...

.handle(string.class, (p, h) -> aservice().servicemethod(p,       (astate) h.get(serviceheader.a_state),      (string) h.get(serviceheader.a_id))) 

(assuming payload string).

note @header annotations meaningless in scenario because directly pulling out headers in lambda expression.

it doesn't need annotated @serviceactivator; can invoke bean method way.

public message<?> servicemethod(         string payload, astate state, string id) {      ... } 

the

.handle("aservice", "servicemethod") 

variation magic happens (matching message contents method parameters). of course, can't "magic" when want invoke method directly in java.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -