1
votes

Could I know how to call Spel for .handle() (invoke Service Activator) in Spring Integration Java DSL?

The reason is I would like to call service activator with parameter. For XML, I could use Spel similar to "@myService.myMethod('param1', 'param2')" in expression attribute.

I can't find something similar in SI Java DSL

1

1 Answers

1
votes

There is no .handle(String expression) variant. We found it a bit redundant and decided that a Lambda variant with full Java access would be better:

.handle(payload, headers) -> this.myService.myMethod('param1', 'param2'))

where this.myService is an @Autowired for your service. All the parameter can be determined similar way.

Let us know why you insist for expression variant, when there is a full Java code access.