Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Http IntegrationFlows at runtime [INT-4436] #8378

Closed
spring-operator opened this issue Mar 20, 2018 · 1 comment
Closed

Adding Http IntegrationFlows at runtime [INT-4436] #8378

spring-operator opened this issue Mar 20, 2018 · 1 comment

Comments

@spring-operator
Copy link
Contributor

Hyung Joo Lee opened INT-4436 and commented

I'm trying to develop an application that dynamically adds flows. I found a solution which using IntegrationFlowContext to dynamically add flows, but it seems not working with Http.inboundGateway or Http.inboundChannelAdapter.
Here's what I did.

@RestController
public class TestController {

  @Autowired
  IntegrationFlowContext context;

  @Autowired
  ConnectionFactory mqConnectionFactory;

  @GetMapping("/register")
  public String registerFlows() {
    context.registration(IntegrationFlows.from(
      Tcp.inboundGateway(Tcp.netServer(10001)))
        .publishSubscribeChannel(subscribers -> subscribers.subscribe(f -> f.handle(Jms.outboundAdapter(mqConnectionFactory).destination("testQueue1"))))
        .get()).register();
    context.registration(IntegrationFlows.from(
      Http.inboundGateway("/hello/{country}")
        .requestMapping(r -> r.methods(HttpMethod.GET).params("msg"))
        .headerExpression("country", "#pathVariables.country")
        .payloadExpression("#requestParams.msg[0]"))
        .handle((payload, headers) -> "de".equals(headers.get("country")) ? "Hallo " + payload : "Hello " + payload)
        .get()).register();
    return "ok";
  }

}

IntegrationFlowContext.registration().register() is working with Tcp.inbound... or Jms.inbound... but not Http.

Even if it's not right changing the service contract I think it is necessary to reconfigure it at runtime.


Reference URL: https://gitter.im/spring-projects/spring-integration?at=5aaf1f1a35dd17022e74d736

Referenced from: pull request #2487

@spring-operator
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants