PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 13, 2022

[FIXED] How to get to RouteDefinition in Camel 3.x (migration from 2.x to 3.x)

 April 13, 2022     apache-camel, java, migration, spring-boot     No comments   

Issue

I upgraded camel-parent from 2.x to 3.x. I had this use in code:

 exchange.getContext()
                .getRoute(exchange.getFromRouteId())
                .getRouteContext()
                .getRoute()
                .stop();
    

Now

 exchange.getContext()
                .getRoute(exchange.getFromRouteId())
                .getRouteContext()

gives us an interface where we cannot get to org.apache.camel.model.RouteDefinition instead we get org.apache.camel.NamedNode on which I cannot execute stop method. Could you tell me how can I get to this RouteDefinition so that I can execute stop method on it?


Solution

The new way to do it (in Camel 3) is to use the RouteController, eg:

camelContext.getRouteController().suspendRoute("my-route-id");



Answered By - TacheDeChoco
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing