camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hubertus.Willuhn" <hubertus.will...@dinsoftware.de>
Subject Re: Spring Boot and Camel 2.17 - HangupSupport Removed!
Date Wed, 20 Apr 2016 10:56:58 GMT
Hi,

Trying out your last solution seems to work, thx.

*BUT*: I am now using your solution of my main() which looks like:

@SpringBootApplication
@Import(Config.class)
public class App
{
	private static final Logger LOG = LoggerFactory.getLogger(App.class);

	public static void main(String[] args) throws Exception
	{
		try {
			LOG.info("Shutdown Application by pressing Ctrl + C");

			SpringApplicationBuilder builder = new
SpringApplicationBuilder(App.class);

			// disable web "thinking"
			builder.web(false);

			ConfigurableApplicationContext context = builder.run(args);

			PropertySource<?> props = new SimpleCommandLinePropertySource(args);

			if(props.containsProperty("dryrun")) {
				LOG.info("---------------------------------------");
				LOG.info("DRY RUN, will now shutdown again.");
				LOG.info("---------------------------------------");

				if(context.isActive()) context.stop();
			}

			LOG.info("{} ready.", App.class.getSimpleName());

			context.getBean(CamelSpringBootApplicationController.class).run();
		}
		catch(Exception e) {
			LOG.error("{} crashed, Reason: {}", App.class.getSimpleName(),
e.getMessage());
			e.printStackTrace();
		}
		finally {
			LOG.info("The Camel has left the building!");
		}
...

So now this works and prints all logs *and* can be shutdown by Ctrl+C
(which seems not to work with plain SpringApplication.run(YourMain.class,
args)!?)

Another interesting fact is, that i am using a CamelContextConfiguration in
my config class like:

       @Bean
	public CamelContextConfiguration contextConfiguration()
	{
		return new CamelContextConfiguration()

The interface of the context configuration decribes two functions
"beforeApplicationStart" and "afterApplicationStart". The later will not be
executed if am using the new Property along with 
SpringApplication.run(YourMain.class, args). This should be fixed!?

Maybe that wasn't on your screen when adding the new behavior?

If neccessary i will try to provide a basic sample application showing my
usecase, but i am very busy right now caching up patching my apps.

Best regards,

Hubertus





--
View this message in context: http://camel.465427.n5.nabble.com/Spring-Boot-and-Camel-2-17-HangupSupport-Removed-tp5781339p5781417.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message